Add user pages.

This commit is contained in:
Edward Betts 2019-09-29 11:51:36 +01:00
parent 6317277c96
commit 1039e9a2d3
2 changed files with 37 additions and 1 deletions

View file

@ -21,7 +21,7 @@
<tbody>
{% for edit in edit_list %}
<tr>
<td><a href="{{ edit.user_page_url }}">{{ edit.username }}</a></td>
<td><a href="{{ url_for('user_page', username=edit.username.replace('_', ' ')) }}">{{ edit.username }}</a></td>
<td><a href="https://www.wikidata.org/wiki/{{ edit.painting_qid }}">{{ edit.painting.label }}</a>
({{ edit.painting_qid }})</td>
<td><a href="https://www.wikidata.org/wiki/{{ edit.depicts_qid }}">{{ edit.depicts.label }}</a>

36
templates/user_page.html Normal file
View file

@ -0,0 +1,36 @@
{% extends "base.html" %}
{% block content %}
<div class="p-2">
<h1>{{ username }}</h1>
<p>This user has added a total of {{ edits.count() }} depicts statements.</p>
<p>{{ painting_count }} paintings have been cataloged.</p>
<table class="table w-auto">
<thead>
<tr>
<th>painting</th>
<th>depicts</th>
<th>when</th>
</tr>
</thead>
<tbody>
{% for edit in edit_list %}
<tr>
<td><a href="https://www.wikidata.org/wiki/{{ edit.painting_qid }}">{{ edit.painting.label }}</a>
({{ 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('%Y %b %d %H:%M') }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}