black'ed
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
from http import HTTPStatus
|
||||
|
||||
from fastapi import Request
|
||||
@@ -15,21 +14,27 @@ from .crud import get_diagonalley_products
|
||||
|
||||
templates = Jinja2Templates(directory="templates")
|
||||
|
||||
|
||||
@diagonalley_ext.get("/", response_class=HTMLResponse)
|
||||
async def index(request: Request, user: User = Depends(check_user_exists)):
|
||||
return diagonalley_renderer().TemplateResponse(
|
||||
"diagonalley/index.html", {"request": request, "user": user.dict()}
|
||||
)
|
||||
|
||||
|
||||
@diagonalley_ext.get("/{stall_id}", response_class=HTMLResponse)
|
||||
async def display(request: Request, stall_id):
|
||||
product = await get_diagonalley_products(stall_id)
|
||||
|
||||
|
||||
if not product:
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.NOT_FOUND, detail="Stall does not exist."
|
||||
)
|
||||
return diagonalley_renderer().TemplateResponse(
|
||||
"diagonalley/stall.html",
|
||||
{"stall": [product.dict() for product in await get_diagonalley_products(stall_id)]}
|
||||
{
|
||||
"stall": [
|
||||
product.dict() for product in await get_diagonalley_products(stall_id)
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user