From 4b8ce9832f7ea0ece9ed0d24980e1d09dbfd13fe Mon Sep 17 00:00:00 2001 From: Brylie Christopher Oxley Date: Tue, 28 Nov 2023 20:22:14 +0200 Subject: [PATCH] Always allow superuser to edit subscribe page --- subscription/models.py | 2 ++ subscription/templates/subscription/index.html | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/subscription/models.py b/subscription/models.py index 5557ca1ee..68741243f 100644 --- a/subscription/models.py +++ b/subscription/models.py @@ -143,10 +143,12 @@ def serve( ) -> HttpResponse: # Redirect to the Manage Subscription page # if the user is logged in and has a subscription. + # Superusers should not be redirected. if ( hasattr(request, "user") and request.user.is_authenticated and request.user.is_subscriber + and not request.user.is_superuser ): # redirect to manage subscription page manage_subscription_page = ManageSubscriptionPage.objects.first() diff --git a/subscription/templates/subscription/index.html b/subscription/templates/subscription/index.html index 21b1aa549..41ad9994f 100644 --- a/subscription/templates/subscription/index.html +++ b/subscription/templates/subscription/index.html @@ -15,6 +15,20 @@

{{ page.title }}

+ {% if request.user.is_superuser %} + + + {% endif %} + {% include_block page.body %} {% endif %} {% endblock %}