added filter on date in view
This commit is contained in:
parent
e6d4d05917
commit
0345e8e8df
@ -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'))
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
<a href="{{ url_for('book',competition=comp['name'],club=club['name']) }}">Book Places</a>
|
||||
{%endif%}
|
||||
</li>
|
||||
<hr />
|
||||
<hr />jinja
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{%endwith%}
|
||||
|
Loading…
x
Reference in New Issue
Block a user