From 7547e6fbd48ce5c8847ce6054389a0fa4c3ff92e Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sun, 29 Sep 2019 11:14:05 +0100 Subject: [PATCH] Improve edit list. --- app.py | 12 +----------- templates/list_edits.html | 8 +++++--- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/app.py b/app.py index 3aedab0..6db2a75 100755 --- a/app.py +++ b/app.py @@ -495,18 +495,8 @@ def get_other(entity): @app.route("/admin/edits") def list_edits(): - # edit_count = Edit.query.count() edit_list = Edit.query.order_by(Edit.timestamp) - - depicts_ids = {edit.depicts_id for edit in Edit.query} - - q = DepictsItem.query.filter(DepictsItem.item_id.in_(depicts_ids)) - depicts_items = {item.item_id: item for item in q} - - return render_template('list_edits.html', - edits=Edit.query, - depicts_items=depicts_items, - edit_list=edit_list) + return render_template('list_edits.html', edits=Edit.query, edit_list=edit_list) @app.route("/next/Q") def next_page(item_id): diff --git a/templates/list_edits.html b/templates/list_edits.html index 43afda9..b0f1119 100644 --- a/templates/list_edits.html +++ b/templates/list_edits.html @@ -18,9 +18,11 @@ {% for edit in edit_list %} {{ edit.username }} - {{ edit.painting_qid }} - {{ depicts_items[edit.depicts_id].label }} ({{ edit.depicts_qid }}) - {{ edit.timestamp }} + {{ edit.painting.label }} + ({{ edit.painting_qid }}) + {{ edit.depicts.label }} + ({{ edit.depicts_qid }}) + {{ edit.timestamp.strftime('%H:%M %a, %d %b %Y') }} {% endfor %}