Add page showing list of series

Resolves: #17
This commit is contained in:
Edward Betts 2023-09-25 14:25:04 +01:00
parent 08a4ffa89f
commit 22067b97e7
4 changed files with 52 additions and 1 deletions

View file

@ -37,7 +37,11 @@ class Series(TimeStampedModel):
slug = Column(String, unique=True) slug = Column(String, unique=True)
wikidata_qid = 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): class Conference(TimeStampedModel):

View file

@ -269,6 +269,14 @@ order by num
return database.session.execute(sql) 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") @app.route("/speakers")
def top_speakers_page() -> str: def top_speakers_page() -> str:
top = top_speakers() top = top_speakers()

View file

@ -2,6 +2,7 @@
<form action="{{ url_for("search_people") }}"> <form action="{{ url_for("search_people") }}">
<a href="{{ url_for("index") }}">conferences</a> <a href="{{ url_for("index") }}">conferences</a>
| <a href="{{ url_for("top_speakers_page") }}">speakers</a> | <a href="{{ url_for("top_speakers_page") }}">speakers</a>
| <a href="{{ url_for("list_series") }}">series</a>
<input type="text" class="form-control" placeholder="speaker name" name="q" id="q"> <input type="text" class="form-control" placeholder="speaker name" name="q" id="q">
<button type="submit" class="btn btn-primary">search</button> <button type="submit" class="btn btn-primary">search</button>

View file

@ -0,0 +1,38 @@
{% extends "base.html" %}
{% block title %}Series &ndash; Conference archive{% endblock %}
{% block content %}
<h1>Conference archive</h1>
<p>{{ items.count() }} series found</p>
{% for item in items %}
<h3>{{ item.name }}</h3>
{% for conf in item.conferences %}
<div style="margin-bottom:1.5rem">
👥
<a href="{{ url_for("conference_page", short_name=conf.short_name) }}">{{ conf.title }}</a>
📅
{{ conf.start.strftime("%d %b %Y") }}
<br/>
{% if conf.venue %}
📍
{{ conf.venue.name }}
&ndash;
{{ conf.venue.city.name }},
{{ conf.venue.city.country.name }}
{{ conf.venue.city.country.flag }}
<br/>
{% endif %}
{{ (conf.end - conf.start).days + 1 }} days,
{{ conf.events.count() }} talks,
{{ conf.people_detail.count() }} speakers<br/>
</div>
{% endfor %}
{% endfor %}
{% endblock %}