Show depicts labels in edit list.

This commit is contained in:
Edward Betts 2019-09-29 09:56:14 +01:00
parent 68cf86162b
commit 123c9d8aa1
2 changed files with 15 additions and 3 deletions

13
app.py
View file

@ -486,7 +486,18 @@ def get_other(entity):
@app.route("/admin/edits")
def list_edits():
return render_template('list_edits.html', edits=Edit.query)
# 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)
@app.route("/next/Q<int:item_id>")
def next_page(item_id):

View file

@ -11,14 +11,15 @@
<th>username</th>
<th>painting</th>
<th>depicts</th>
<th>when</th>
</tr>
</thead>
<tbody>
{% for edit in edits %}
{% for edit in edit_list %}
<tr>
<td><a href="{{ edit.user_page_url }}">{{ edit.username }}</a></td>
<td>{{ edit.painting_qid }}</td>
<td>{{ edit.depicts_qid }}</td>
<td>{{ depicts_items[edit.depicts_id].label }} ({{ edit.depicts_qid }})</td>
<td>{{ edit.timestamp }}</td>
</tr>
{% endfor %}