Improve edit list.
This commit is contained in:
parent
ad39d8d1d5
commit
7547e6fbd4
12
app.py
12
app.py
|
@ -495,18 +495,8 @@ def get_other(entity):
|
||||||
|
|
||||||
@app.route("/admin/edits")
|
@app.route("/admin/edits")
|
||||||
def list_edits():
|
def list_edits():
|
||||||
# edit_count = Edit.query.count()
|
|
||||||
edit_list = Edit.query.order_by(Edit.timestamp)
|
edit_list = Edit.query.order_by(Edit.timestamp)
|
||||||
|
return render_template('list_edits.html', edits=Edit.query, edit_list=edit_list)
|
||||||
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>")
|
@app.route("/next/Q<int:item_id>")
|
||||||
def next_page(item_id):
|
def next_page(item_id):
|
||||||
|
|
|
@ -18,9 +18,11 @@
|
||||||
{% for edit in edit_list %}
|
{% for edit in edit_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ edit.user_page_url }}">{{ edit.username }}</a></td>
|
<td><a href="{{ edit.user_page_url }}">{{ edit.username }}</a></td>
|
||||||
<td>{{ edit.painting_qid }}</td>
|
<td><a href="https://www.wikidata.org/wiki/{{ edit.painting_qid }}">{{ edit.painting.label }}</a>
|
||||||
<td>{{ depicts_items[edit.depicts_id].label }} ({{ edit.depicts_qid }})</td>
|
({{ edit.painting_qid }})</td>
|
||||||
<td>{{ edit.timestamp }}</td>
|
<td><a href="https://www.wikidata.org/wiki/{{ edit.depicts_qid }}">{{ edit.depicts.label }}</a>
|
||||||
|
({{ edit.depicts_qid }})</td>
|
||||||
|
<td>{{ edit.timestamp.strftime('%H:%M %a, %d %b %Y') }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in a new issue