lavkach3
1from fastapi import APIRouter, Depends
2from fastapi import Request
3from fastapi.responses import HTMLResponse
4
5from app.front.template_spec import templates
6from app.front.utills import BasePermit
7from core.frontend.constructor import ClassView
8
9store_router = APIRouter()
10
11
12class StorePermit(BasePermit):
13permits = ['store_list']
14
15
16@store_router.get("", response_class=HTMLResponse, dependencies=[Depends(StorePermit)])
17async def store(request: Request):
18cls = ClassView(request, 'store')
19template = f'widgets/list{"" if request.scope["htmx"].hx_request else "-full"}.html'
20return templates.TemplateResponse(request, template, context={'cls': cls})
21