More detail on the list edits page.
This commit is contained in:
parent
7547e6fbd4
commit
6317277c96
16
app.py
16
app.py
|
@ -9,6 +9,7 @@ from requests_oauthlib import OAuth1Session
|
|||
from urllib.parse import urlencode
|
||||
from werkzeug.exceptions import InternalServerError
|
||||
from werkzeug.debug.tbtools import get_current_traceback
|
||||
from sqlalchemy import func, distinct
|
||||
import requests.exceptions
|
||||
import requests
|
||||
import lxml.html
|
||||
|
@ -496,7 +497,20 @@ def get_other(entity):
|
|||
@app.route("/admin/edits")
|
||||
def list_edits():
|
||||
edit_list = Edit.query.order_by(Edit.timestamp)
|
||||
return render_template('list_edits.html', edits=Edit.query, edit_list=edit_list)
|
||||
|
||||
painting_count = (database.session
|
||||
.query(func.count(distinct(Edit.painting_id)))
|
||||
.scalar())
|
||||
|
||||
user_count = (database.session
|
||||
.query(func.count(distinct(Edit.username)))
|
||||
.scalar())
|
||||
|
||||
return render_template('list_edits.html',
|
||||
edits=Edit.query,
|
||||
edit_list=edit_list,
|
||||
painting_count=painting_count,
|
||||
user_count=user_count)
|
||||
|
||||
@app.route("/next/Q<int:item_id>")
|
||||
def next_page(item_id):
|
||||
|
|
|
@ -3,7 +3,11 @@
|
|||
{% block content %}
|
||||
<div class="p-2">
|
||||
|
||||
<p>This tool has been used to save {{ edits.count() }} edits.</p>
|
||||
<p>This tool has been used to add a total of {{ edits.count() }} depicts statements.</p>
|
||||
|
||||
<p>{{ user_count }} users have tried this tool.</p>
|
||||
|
||||
<p>{{ painting_count }} paintings have been cataloged.</p>
|
||||
|
||||
<table class="table w-auto">
|
||||
<thead>
|
||||
|
@ -22,7 +26,7 @@
|
|||
({{ edit.painting_qid }})</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>
|
||||
<td>{{ edit.timestamp.strftime('%Y %b %d %H:%M') }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in a new issue