Add page to generate a list of trips as text
This commit is contained in:
parent
6c8e1bf48d
commit
8b777e64fc
3 changed files with 110 additions and 0 deletions
17
web_view.py
17
web_view.py
|
|
@ -220,6 +220,23 @@ def trip_list() -> str:
|
|||
)
|
||||
|
||||
|
||||
@app.route("/trip/text")
|
||||
def trip_list_text() -> str:
|
||||
"""Page showing a list of trips."""
|
||||
trip_list = agenda.trip.build_trip_list()
|
||||
|
||||
today = date.today()
|
||||
future = [item for item in trip_list if item.start > today]
|
||||
|
||||
return flask.render_template(
|
||||
"trip_list_text.html",
|
||||
future=future,
|
||||
today=today,
|
||||
get_country=agenda.get_country,
|
||||
format_list_with_ampersand=format_list_with_ampersand,
|
||||
)
|
||||
|
||||
|
||||
def human_readable_delta(future_date: date) -> str | None:
|
||||
"""
|
||||
Calculate the human-readable time delta for a given future date.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue