From d6e7a09d084039ecb81748182d94f9683cf9bd1d Mon Sep 17 00:00:00 2001 From: Tudor Amariei Date: Thu, 5 Dec 2024 18:50:30 +0200 Subject: [PATCH] Don't allow NGOs to access the new admin for now --- backend/donations/views/dashboard/dashboard.py | 2 +- backend/redirectioneaza/settings/unfold.py | 1 + backend/templates/v3/admin/base_admin.html | 13 +++++++++++-- backend/templates/v3/admin/index.html | 3 +-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/backend/donations/views/dashboard/dashboard.py b/backend/donations/views/dashboard/dashboard.py index cad56f0d..5819288a 100644 --- a/backend/donations/views/dashboard/dashboard.py +++ b/backend/donations/views/dashboard/dashboard.py @@ -28,4 +28,4 @@ def callback(request, context): if user.is_admin: return admin_callback(request, context) - return ngo_callback(request, context) + return {"redirect": reverse("contul-meu")} diff --git a/backend/redirectioneaza/settings/unfold.py b/backend/redirectioneaza/settings/unfold.py index a6977804..c3e1f6f7 100644 --- a/backend/redirectioneaza/settings/unfold.py +++ b/backend/redirectioneaza/settings/unfold.py @@ -16,6 +16,7 @@ "title": _("Dashboard"), "icon": "dashboard", "link": reverse_lazy("admin:index"), + "permission": lambda request: request.user.is_superuser, }, ], }, diff --git a/backend/templates/v3/admin/base_admin.html b/backend/templates/v3/admin/base_admin.html index 17dce38c..30d0a8c3 100644 --- a/backend/templates/v3/admin/base_admin.html +++ b/backend/templates/v3/admin/base_admin.html @@ -21,9 +21,18 @@

{% endblock %} {% block content %} - {% include "unfold/helpers/messages.html" %} -{% endblock %} {% if display_work_in_progress %} {% include "admin/announcements/work_in_progress.html" %} {% endif %} + + + + {% if redirect %} + + {% endif %} + + {% block body %}{% endblock body %} + + +{% endblock content %} diff --git a/backend/templates/v3/admin/index.html b/backend/templates/v3/admin/index.html index 99394c31..ec740667 100644 --- a/backend/templates/v3/admin/index.html +++ b/backend/templates/v3/admin/index.html @@ -2,8 +2,7 @@ {% load unfold i18n %} -{% block content %} - +{% block body %} {% component "unfold/components/container.html" %} {% if header_stats %}