summaryrefslogtreecommitdiff
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/films.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/routers/films.py b/routers/films.py
index e432a5c..c85d811 100644
--- a/routers/films.py
+++ b/routers/films.py
@@ -443,10 +443,24 @@ def get_films_partial(
async def film_detail(film_id: int, request: Request, db: Session = Depends(get_db)):
film = _get_film_or_404(db, film_id)
tmdb_context = await _film_tmdb_context(film)
+
+ rewatch_history = (
+ db.query(Film)
+ .filter(Film.title == film.title, Film.shelf == "diary")
+ .order_by(Film.date_watched.asc())
+ .all()
+ )
+
return templates.TemplateResponse(
request=request,
name="detail.html",
- context={"request": request, "film": film, "active_shelf": film.shelf, "tmdb_context": tmdb_context},
+ context={
+ "request": request,
+ "film": film,
+ "active_shelf": film.shelf,
+ "tmdb_context": tmdb_context,
+ "rewatch_history": rewatch_history,
+ },
)