From afedf2d0bda4a254732bb9eb7f941de58f318dcb Mon Sep 17 00:00:00 2001 From: moanos Date: Sun, 13 Jul 2025 00:31:21 +0200 Subject: [PATCH] feat: add button to mark all notifications as read and fix action --- .../fellchensammlung/notifications.html | 19 ++++++++++++++++--- src/fellchensammlung/views.py | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/fellchensammlung/templates/fellchensammlung/notifications.html b/src/fellchensammlung/templates/fellchensammlung/notifications.html index 24bf6d6..8cb9a3c 100644 --- a/src/fellchensammlung/templates/fellchensammlung/notifications.html +++ b/src/fellchensammlung/templates/fellchensammlung/notifications.html @@ -5,9 +5,22 @@ {% block content %}

{% translate 'Benachrichtigungen' %}

- {% with notifications=notifications_unread %} - {% include "fellchensammlung/lists/list-notifications.html" %} - {% endwith %} + {% if notifications_unread|length > 0 %} +
+
+ {% csrf_token %} + + +
+
+ {% endif %} +
+ {% with notifications=notifications_unread %} + {% include "fellchensammlung/lists/list-notifications.html" %} + {% endwith %} +
diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py index cb1eb07..93dbfbc 100644 --- a/src/fellchensammlung/views.py +++ b/src/fellchensammlung/views.py @@ -563,7 +563,7 @@ def process_notification_actions(request, action): return render(request, "fellchensammlung/errors/403.html", status=403) notification.mark_read() elif action == "notification_mark_all_read": - notifications = Notification.objects.filter(user=request.user, mark_read=False) + notifications = Notification.objects.filter(user_to_notify=request.user, read=False) for notification in notifications: notification.mark_read() return None