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 urllib.parse import urlencode
|
||||||
from werkzeug.exceptions import InternalServerError
|
from werkzeug.exceptions import InternalServerError
|
||||||
from werkzeug.debug.tbtools import get_current_traceback
|
from werkzeug.debug.tbtools import get_current_traceback
|
||||||
|
from sqlalchemy import func, distinct
|
||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
import requests
|
import requests
|
||||||
import lxml.html
|
import lxml.html
|
||||||
|
@ -496,7 +497,20 @@ def get_other(entity):
|
||||||
@app.route("/admin/edits")
|
@app.route("/admin/edits")
|
||||||
def list_edits():
|
def list_edits():
|
||||||
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)
|
|
||||||
|
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>")
|
@app.route("/next/Q<int:item_id>")
|
||||||
def next_page(item_id):
|
def next_page(item_id):
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="p-2">
|
<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">
|
<table class="table w-auto">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -22,7 +26,7 @@
|
||||||
({{ edit.painting_qid }})</td>
|
({{ edit.painting_qid }})</td>
|
||||||
<td><a href="https://www.wikidata.org/wiki/{{ edit.depicts_qid }}">{{ edit.depicts.label }}</a>
|
<td><a href="https://www.wikidata.org/wiki/{{ edit.depicts_qid }}">{{ edit.depicts.label }}</a>
|
||||||
({{ edit.depicts_qid }})</td>
|
({{ 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>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in a new issue