Basic tag browse buttons

This commit is contained in:
Leigh Morresi
2021-01-29 15:51:30 +01:00
parent 016937d5de
commit b6e9bb12fb
4 changed files with 36 additions and 5 deletions

View File

@@ -79,15 +79,23 @@ def _jinja2_filter_datetimestamp(timestamp, format="%Y-%m-%d %H:%M:%S"):
def main_page():
global messages
limit_tag = request.args.get('tag')
# Sort by last_changed and add the uuid which is usually the key..
sorted_watches=[]
sorted_watches = []
for uuid, watch in datastore.data['watching'].items():
watch['uuid']=uuid
sorted_watches.append(watch)
if limit_tag != None:
if watch['tag'] == limit_tag:
watch['uuid'] = uuid
sorted_watches.append(watch)
else:
watch['uuid'] = uuid
sorted_watches.append(watch)
sorted_watches.sort(key=lambda x: x['last_changed'], reverse=True)
output = render_template("watch-overview.html", watches=sorted_watches, messages=messages)
existing_tags = datastore.get_all_tags()
output = render_template("watch-overview.html", watches=sorted_watches, messages=messages, tags=existing_tags)
# Show messages but once.
messages = []