lavkach3
1from fastapi import APIRouter
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
9uom_router = APIRouter()
10from fastapi import Depends
11class UomPermit(BasePermit):
12permits = ['uom_list']
13
14
15@uom_router.get("", response_class=HTMLResponse, dependencies=[Depends(UomPermit)])
16async def uom(request: Request):
17cls = ClassView(request, 'uom')
18template = f'widgets/list{"" if request.scope["htmx"].hx_request else "-full"}.html'
19return templates.TemplateResponse(request, template, context={'cls': cls})
20
21