added filter on date in view
This commit is contained in:
parent
e6d4d05917
commit
0345e8e8df
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
from flask import Flask,render_template,request,redirect,flash,url_for,session
|
from flask import Flask,render_template,request,redirect,flash,url_for,session
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
def loadClubs():
|
def loadClubs():
|
||||||
@ -27,8 +28,10 @@ def index():
|
|||||||
@app.route('/showSummary',methods=['POST'])
|
@app.route('/showSummary',methods=['POST'])
|
||||||
def showSummary():
|
def showSummary():
|
||||||
club = [club for club in clubs if club['email'] == request.form['email']]
|
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:
|
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")
|
flash("The email isn't found")
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<a href="{{ url_for('book',competition=comp['name'],club=club['name']) }}">Book Places</a>
|
<a href="{{ url_for('book',competition=comp['name'],club=club['name']) }}">Book Places</a>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
</li>
|
</li>
|
||||||
<hr />
|
<hr />jinja
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{%endwith%}
|
{%endwith%}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user