async def get(self, request: Request) -> _TemplateResponse: context = {"request": request} anime = [] for i in Anime.select(): try: fansub = Fansub.get(id=i.fansub_id) fansub_name = fansub.name except Fansub.DoesNotExist: fansub_name = "N.A" anime.append({ "name": i.name, "url": [{ "name": parts.split(";")[0], "href": parts.split(";")[1] } for parts in i.url.split(",")] if len(i.url) else [], "fansub": fansub_name }) context.update({"anime": anime}) return templates.TemplateResponse("home.html", context)
def __response(self, request: Request, extra: Optional[dict] = None) -> _TemplateResponse: context = {"request": request, "anime": Anime.select()} if extra: context.update(extra) return templates.TemplateResponse("anime/backend.html", context)