From 9bab970043330c9f27f4b29a55f046a3b701f026 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Wed, 27 Mar 2019 15:29:56 +0000 Subject: Allow admin to view annotations --- app/admin/routes.py | 17 +++++++++++++++++ app/templates/admin/annotations.html | 22 ++++++++++++++++++++++ app/templates/admin/index.html | 4 ++++ 3 files changed, 43 insertions(+) create mode 100644 app/templates/admin/annotations.html (limited to 'app') diff --git a/app/admin/routes.py b/app/admin/routes.py index f8d72d2..bed0d18 100644 --- a/app/admin/routes.py +++ b/app/admin/routes.py @@ -168,6 +168,23 @@ def add_dataset(): return render_template("admin/add.html", title="Add Dataset", form=form) +@bp.route("/annotations", methods=("GET",)) +@admin_required +def view_annotations(): + annotations = ( + Annotation.query.join(Task, Annotation.task) + .join(User, Task.user) + .join(Dataset, Task.dataset) + .order_by(Dataset.name, User.username, Annotation.cp_index) + .all() + ) + return render_template( + "admin/annotations.html", + title="View Annotations", + annotations=annotations, + ) + + @bp.route("/", methods=("GET",)) @admin_required def index(): diff --git a/app/templates/admin/annotations.html b/app/templates/admin/annotations.html new file mode 100644 index 0000000..4807b8e --- /dev/null +++ b/app/templates/admin/annotations.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} + +{% block app_content %} +

View Annotations

+
+ + + + + + + {% for ann in annotations %} + + + + + + {% endfor %} + +
DatasetUsernameChangepoint Index
{{ ann.task.dataset.name }}{{ ann.task.user.username }}{% if ann.cp_index is none %}No CP{% else %}{{ ann.cp_index }}{% endif %}
+
+{% endblock %} diff --git a/app/templates/admin/index.html b/app/templates/admin/index.html index c6b1f25..a8a8c73 100644 --- a/app/templates/admin/index.html +++ b/app/templates/admin/index.html @@ -18,5 +18,9 @@ View and manage datasets +
  • + View + annotations +
  • {% endblock %} -- cgit v1.2.3