From efaf0c89098ed842dba8f12bedef323472cbfb9b Mon Sep 17 00:00:00 2001 From: MathiasDPX Date: Wed, 18 Sep 2024 20:32:49 +0200 Subject: [PATCH] order by interest and add url --- app.py | 6 ++++++ templates/index.html | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index ce8e621..96f4f5a 100644 --- a/app.py +++ b/app.py @@ -51,6 +51,8 @@ def getShowtimes(date): "synopsis": movie.synopsis, "affiche": movie.affiche, "director": movie.director, + "wantToSee": movie.wantToSee, + "url": f"https://www.allocine.fr/film/fichefilm_gen_cfilm={movie.id}.html", "seances": {} } @@ -60,6 +62,10 @@ def getShowtimes(date): data[movie.title]["seances"][theater.name].append(showtime.startsAt.strftime("%H:%M")) + data = data.values() + + data = sorted(data, key=lambda x: x["wantToSee"], reverse=True) + return data showtimes = [] diff --git a/templates/index.html b/templates/index.html index 2b0c395..050ffb5 100644 --- a/templates/index.html +++ b/templates/index.html @@ -43,13 +43,13 @@
- {% for film in films.values() %} + {% for film in films %}
-

{{film.title}}

+

{{film.title}}

Réalisateur : {{film.director}}

Casting : {{ film.casting }}