diff --git a/confarchive/model.py b/confarchive/model.py index 6fc4561..70394cf 100644 --- a/confarchive/model.py +++ b/confarchive/model.py @@ -37,7 +37,11 @@ class Series(TimeStampedModel): slug = Column(String, unique=True) wikidata_qid = Column(String, unique=True) - conferences = relationship("Conference", back_populates="series") + conferences = relationship( + "Conference", + order_by="Conference.start", + back_populates="series", + ) class Conference(TimeStampedModel): diff --git a/main.py b/main.py index c85ec45..0f7a1ad 100755 --- a/main.py +++ b/main.py @@ -269,6 +269,14 @@ order by num return database.session.execute(sql) +@app.route("/series") +def list_series() -> str: + """Page showing list of conference series.""" + items = model.Series.query + + return flask.render_template("series/list.html", items=items) + + @app.route("/speakers") def top_speakers_page() -> str: top = top_speakers() diff --git a/templates/navbar.html b/templates/navbar.html index 600cde8..0b740f3 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -2,6 +2,7 @@
conferences | speakers + | series diff --git a/templates/series/list.html b/templates/series/list.html new file mode 100644 index 0000000..2c62625 --- /dev/null +++ b/templates/series/list.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block title %}Series – Conference archive{% endblock %} + + {% block content %} +

Conference archive

+ +

{{ items.count() }} series found

+ {% for item in items %} +

{{ item.name }}

+ {% for conf in item.conferences %} + +
+ 👥 + {{ conf.title }} + 📅 + {{ conf.start.strftime("%d %b %Y") }} +
+ {% if conf.venue %} + 📍 + {{ conf.venue.name }} + – + {{ conf.venue.city.name }}, + {{ conf.venue.city.country.name }} + {{ conf.venue.city.country.flag }} +
+ {% endif %} + + {{ (conf.end - conf.start).days + 1 }} days, + {{ conf.events.count() }} talks, + {{ conf.people_detail.count() }} speakers
+
+ + + {% endfor %} + {% endfor %} + +{% endblock %}