This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from fastapi import FastAPI | |
| app = FastAPI() | |
| @app.get('/') | |
| def index(request: Request, db: Session = Depends(get_db), | |
| current_user: models.User = Depends(current_user)): | |
| users = crud.get_channels(db, skip=0, limit=100) | |
| return templates.TemplateResponse('index.html', {"title": 'home', | |
| "users": users, | |
| "request": request, | |
| "current_user": current_user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from starlette.templating import Jinja2Templates | |
| from .template_env import timesince, price_format, bot_insert, get_flashed_messages | |
| templates = Jinja2Templates(directory="app/templates") | |
| templates.env.filters.update({"timesince": timesince, | |
| "price_format": price_format}) | |
| templates.env.globals.update({"bot_insert": bot_insert, | |
| "get_flashed_messages": get_flashed_messages}) |