summaryrefslogtreecommitdiff
path: root/routers/films.py
diff options
context:
space:
mode:
authorTyler Hoang <tyler@tylerhoang.xyz>2026-05-06 16:23:59 -0700
committerTyler Hoang <tyler@tylerhoang.xyz>2026-05-06 16:23:59 -0700
commit138eaaa12cdaeb6035951ff4f1547d73e8d12612 (patch)
tree4337312e2a7dfa7dc1f6a4a4f5088771b57591ee /routers/films.py
parent44627e1fec2d5e11179d8ce07fff95635a6633a2 (diff)
Add director image and biography to director page
- Fetch director profile image and biography from TMDB API - Display image next to director name with lazy loading - Show biography below director name - Gracefully handle missing data (image/biography optional) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Diffstat (limited to 'routers/films.py')
-rw-r--r--routers/films.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/routers/films.py b/routers/films.py
index 4bb7cc9..afcf0ae 100644
--- a/routers/films.py
+++ b/routers/films.py
@@ -444,7 +444,7 @@ async def update_film_stars(film_id: int, request: Request, db: Session = Depend
@router.get("/director/{director_name}")
-def director_detail(director_name: str, request: Request, db: Session = Depends(get_db)):
+async def director_detail(director_name: str, request: Request, db: Session = Depends(get_db)):
films = _director_films(db, director_name)
if not films:
raise HTTPException(status_code=404, detail="Director not found.")
@@ -477,12 +477,17 @@ def director_detail(director_name: str, request: Request, db: Session = Depends(
)[0][0]
average_stars = round(sum(film.stars for film in films) / len(films), 1)
+ from services.tmdb import director_info
+ director_data = await director_info(display_name)
+
return templates.TemplateResponse(
request=request,
name="director.html",
context={
"request": request,
"director_name": display_name,
+ "director_image": director_data["image"],
+ "director_biography": director_data["biography"],
"films": films,
"director_summary": {
"total_films_logged": len(films),