From 0345e8e8df5bc1da04a305433e06748512d26286 Mon Sep 17 00:00:00 2001 From: yann Date: Thu, 26 Jun 2025 11:13:38 +0200 Subject: [PATCH] added filter on date in view --- server.py | 5 ++++- templates/welcome.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index 1818b65..5cd6648 100644 --- a/server.py +++ b/server.py @@ -1,5 +1,6 @@ import json from flask import Flask,render_template,request,redirect,flash,url_for,session +from datetime import datetime def loadClubs(): @@ -27,8 +28,10 @@ def index(): @app.route('/showSummary',methods=['POST']) def showSummary(): club = [club for club in clubs if club['email'] == request.form['email']] + current_compet = [compet for compet in competitions if datetime.strptime(compet['date'], '%Y-%m-%d %H:%M:%S') > datetime.now()] + print(current_compet) if club: - return render_template('welcome.html', club=club[0], competitions=competitions) + return render_template('welcome.html', club=club[0], competitions=current_compet) flash("The email isn't found") return redirect(url_for('index')) diff --git a/templates/welcome.html b/templates/welcome.html index 223f4b2..efb2c7e 100644 --- a/templates/welcome.html +++ b/templates/welcome.html @@ -27,7 +27,7 @@ Book Places {%endif%} -
+
jinja {% endfor %} {%endwith%}