aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2019-03-26 16:34:47 +0000
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2019-03-26 16:35:16 +0000
commit3f799fbadbce46c8524b216713ba05cca0618f7e (patch)
tree67e88657796030864a10dc6f546a6147291f2d73
parentRemove user id and dataset id and sort tasks by username (diff)
downloadAnnotateChange-3f799fbadbce46c8524b216713ba05cca0618f7e.tar.gz
AnnotateChange-3f799fbadbce46c8524b216713ba05cca0618f7e.zip
Add user table
-rw-r--r--app/admin/routes.py7
-rw-r--r--app/templates/admin/index.html4
-rw-r--r--app/templates/admin/manage_users.html30
3 files changed, 41 insertions, 0 deletions
diff --git a/app/admin/routes.py b/app/admin/routes.py
index 6b5bf68..89abb41 100644
--- a/app/admin/routes.py
+++ b/app/admin/routes.py
@@ -75,6 +75,13 @@ def manage_tasks():
"admin/manage.html", title="Assign Task", form=form, tasks=tasks
)
+@bp.route("/manage/users", methods=("GET", "POST"))
+@admin_required
+def manage_users():
+ users = User.query.all()
+ return render_template(
+ "admin/manage_users.html", title="Manage Users", users=users)
+
@bp.route("/add", methods=("GET", "POST"))
@admin_required
diff --git a/app/templates/admin/index.html b/app/templates/admin/index.html
index 136d1d5..c5f5e6b 100644
--- a/app/templates/admin/index.html
+++ b/app/templates/admin/index.html
@@ -10,5 +10,9 @@
<a href="{{ url_for("admin.manage_tasks") }}">View and manage
tasks</a>
</li>
+ <li>
+ <a href="{{ url_for("admin.manage_users") }}">View and manage
+ users</a>
+ </li>
</ul>
{% endblock %}
diff --git a/app/templates/admin/manage_users.html b/app/templates/admin/manage_users.html
new file mode 100644
index 0000000..fcfc86c
--- /dev/null
+++ b/app/templates/admin/manage_users.html
@@ -0,0 +1,30 @@
+{% extends "base.html" %}
+
+{% block app_content %}
+<h1>Manage Users</h1>
+<br>
+<h1>User Overview</h1>
+<article class="overview">
+ <table class="table table-striped">
+ <thead class="thead-dark">
+ <th scope="col">ID</th>
+ <th scope="col">Username</th>
+ <th scope="col">Email</th>
+ <th scope="col">Confirmed</th>
+ <th scope="col">Last Active</th>
+ <th scope="col">Admin</th>
+ </thead>
+ {% for user in users %}
+ <tr>
+ <th scope="row">{{ user.id }}</th>
+ <td>{{ user.username }}</td>
+ <td>{{ user.email }}</td>
+ <td>{% if user.is_confirmed %}Yes{% else %}No{% endif %}</td>
+ <td>{{ user.last_active }}</td>
+ <td>{% if user.is_admin %}Yes{% else %}{% endif %}</td>
+ </tr>
+ {% endfor %}
+ </tr>
+ </table>
+</article>
+{% endblock %}