From 658cf6f53f031eeeaae6085163ac3c1fa1f6adc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Sun, 23 Feb 2025 14:26:41 +0100
Subject: [PATCH] Add missing template for AKs by Owner view

This fixes #243
---
 .../templates/admin/AKModel/aks_by_user.html  | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 AKModel/templates/admin/AKModel/aks_by_user.html

diff --git a/AKModel/templates/admin/AKModel/aks_by_user.html b/AKModel/templates/admin/AKModel/aks_by_user.html
new file mode 100644
index 00000000..2528b4c9
--- /dev/null
+++ b/AKModel/templates/admin/AKModel/aks_by_user.html
@@ -0,0 +1,38 @@
+{% extends "admin/base_site.html" %}
+{% load tags_AKModel %}
+
+{% load i18n %}
+{% load tz %}
+{% load fontawesome_6 %}
+
+{% block title %}{% trans "AKs by Owner" %}: {{owner}}{% endblock %}
+
+{% block content %}
+    {% timezone event.timezone %}
+        <h2>[{{event}}] <a href="{% url 'admin:AKModel_akowner_change' owner.pk %}">{{owner}}</a> - {% trans "AKs" %}</h2>
+
+        <div class="row mt-4">
+            <table class="table table-striped">
+                {% for ak in owner.ak_set.all %}
+                    <tr>
+                        <td>{{ ak }}</td>
+                        {% if "AKSubmission"|check_app_installed %}
+                            <td class="text-end">
+                                <a href="{{ ak.detail_url }}" data-bs-toggle="tooltip"
+                                   title="{% trans 'Details' %}"
+                                   class="btn btn-primary">{% fa6_icon 'info' 'fas' %}</a>
+                                {% if event.active %}
+                                    <a href="{{ ak.edit_url }}" data-bs-toggle="tooltip"
+                                       title="{% trans 'Edit' %}"
+                                       class="btn btn-success">{% fa6_icon 'pencil-alt' 'fas' %}</a>
+                                {% endif %}
+                            {% endif %}
+                        </td>
+                    </tr>
+                {% empty %}
+                    <tr><td>{% trans "This user does not have any AKs currently" %}</td></tr>
+                {% endfor %}
+            </table>
+        </div>
+    {% endtimezone %}
+{% endblock %}
-- 
GitLab