From 9840a2c1330d634b3f47bd20969a05c8623723fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Tue, 2 Sep 2025 03:30:18 +0200 Subject: [PATCH] Refactor profile view to separate game and organization subscriptions for improved clarity in the profile template. --- accounts/views.py | 5 ++++- templates/accounts/profile.html | 24 +++++++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/accounts/views.py b/accounts/views.py index 1e52ca1..6e3e34f 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -86,11 +86,14 @@ def profile_view(request: HttpRequest) -> HttpResponse: HttpResponse: Rendered profile template. """ subscriptions = NotificationSubscription.objects.filter(user=request.user) # type: ignore[misc] + game_subscriptions = subscriptions.filter(game_id__isnull=False) + org_subscriptions = subscriptions.filter(organization_id__isnull=False) return render( request, "accounts/profile.html", { "user": request.user, - "subscriptions": subscriptions, + "game_subscriptions": game_subscriptions, + "org_subscriptions": org_subscriptions, }, ) diff --git a/templates/accounts/profile.html b/templates/accounts/profile.html index c6dc6be..e17263e 100644 --- a/templates/accounts/profile.html +++ b/templates/accounts/profile.html @@ -26,19 +26,25 @@ Logout -

Will get notifications to:

+

Will get notifications for these subscriptions:

+

Games

+

Organizations

+ {% endblock content %}