Add events listing to events page
This commit is contained in:
parent
b74d950c08
commit
80e1f927ea
2 changed files with 16 additions and 1 deletions
|
@ -1,4 +1,6 @@
|
||||||
|
import datetime
|
||||||
from flask import Blueprint, render_template
|
from flask import Blueprint, render_template
|
||||||
|
from acmsite.models import Event
|
||||||
|
|
||||||
bp = Blueprint('main', __name__)
|
bp = Blueprint('main', __name__)
|
||||||
|
|
||||||
|
@ -8,7 +10,8 @@ def homepage():
|
||||||
|
|
||||||
@bp.route("/events")
|
@bp.route("/events")
|
||||||
def events():
|
def events():
|
||||||
return render_template("events.html")
|
events = Event.query.filter(Event.start_time > datetime.datetime.now()).all()
|
||||||
|
return render_template("events.html", events=events)
|
||||||
|
|
||||||
@bp.route("/join")
|
@bp.route("/join")
|
||||||
def join():
|
def join():
|
||||||
|
|
|
@ -1,7 +1,19 @@
|
||||||
{% extends 'layout.html' %}
|
{% extends 'layout.html' %}
|
||||||
|
{% from 'bootstrap5/table.html' import render_table %}
|
||||||
|
|
||||||
{% block app_content %}
|
{% block app_content %}
|
||||||
|
|
||||||
We're still working on this! Check back later.
|
We're still working on this! Check back later.
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
{% if events == [] %}
|
||||||
|
<p>No upcoming events. If it's a break, enjoy your break!</p>
|
||||||
|
{% else %}
|
||||||
|
{% for e in events %}
|
||||||
|
<h4>{{ e.name }}</h4>
|
||||||
|
<small style="font-style: italic; color: grey; margin-bottom: 1rem;">{{ e.start_time }} - {{ e.end_time }} - {{ e.location }}</small>
|
||||||
|
<p>{{ e.description }}</p>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue