Split conference list current, future, past
This commit is contained in:
parent
0fa6a2cdda
commit
e1540d9bfe
2 changed files with 35 additions and 24 deletions
17
web_view.py
17
web_view.py
|
|
@ -82,15 +82,22 @@ def conference_list() -> str:
|
|||
item_list = yaml.safe_load(open(filepath))["conferences"]
|
||||
today = date.today()
|
||||
for conf in item_list:
|
||||
conf["as_date"] = as_date(conf["start"])
|
||||
conf["start_date"] = as_date(conf["start"])
|
||||
conf["end_date"] = as_date(conf["end"])
|
||||
|
||||
item_list.sort(key=operator.itemgetter("as_date"))
|
||||
item_list.sort(key=operator.itemgetter("start_date"))
|
||||
|
||||
past = [conf for conf in item_list if conf["as_date"] < today]
|
||||
future = [conf for conf in item_list if conf["as_date"] >= today]
|
||||
current = [
|
||||
conf
|
||||
for conf in item_list
|
||||
if conf["start_date"] <= today and conf["end_date"] >= today
|
||||
]
|
||||
|
||||
past = [conf for conf in item_list if conf["end_date"] < today]
|
||||
future = [conf for conf in item_list if conf["start_date"] > today]
|
||||
|
||||
return flask.render_template(
|
||||
"conference_list.html", item_list=past + ["today"] + future, today=today
|
||||
"conference_list.html", current=current, past=past, future=future, today=today
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue