init.py in submodules, aliases for different redirections

This commit is contained in:
DarkCat09 2023-02-20 12:41:29 +04:00
parent 03e4c63d38
commit 6b9d616808
7 changed files with 75 additions and 42 deletions

View file

@ -1,3 +1,5 @@
"""Module containing FastAPI paths"""
import abc
from fastapi import FastAPI

View file

@ -5,7 +5,7 @@ from pathlib import Path
from fastapi import Request, Response
from fastapi import HTTPException
from . import paths
from . import Paths
from .. import respond
from .. import common
@ -13,7 +13,7 @@ from .. import common
codes = [404, 500]
class ErrorsPaths(paths.Paths):
class ErrorsPaths(Paths):
"""Sets up custom error pages,
inherited from paths.Paths"""

View file

@ -2,11 +2,11 @@
from fastapi import Request, Response
from . import paths
from . import Paths
from .. import respond
class MainPaths(paths.Paths):
class MainPaths(Paths):
"""Main FastAPI app paths,
inherits paths.Paths"""

View file

@ -1,3 +1,5 @@
"""Paths related to working with database"""
from sqlalchemy.orm import Session
from fastapi import Depends
@ -5,17 +7,18 @@ from fastapi import Request, Response
from starlette_wtf import csrf_protect
from . import paths
from . import Paths
from .. import respond
from ..sql import db
from ..sql import crud
from ..sql import schemas
from ..forms import get_form
from ..forms.users import AddUserForm
LIMIT = 10
class TablePaths(paths.Paths):
class TablePaths(Paths):
def add_paths(self) -> None:
@ -42,7 +45,7 @@ class TablePaths(paths.Paths):
req: Request,
db_s: Session = Depends(db.get_db)) -> Response:
form = await AddUserForm.from_formdata(request=req)
form = await get_form(AddUserForm, req)
if await form.validate_on_submit():