From cbf92651f0d202d9d526ba22deb1628b00d87f6c Mon Sep 17 00:00:00 2001 From: korenstin Date: Sun, 4 Aug 2024 21:58:57 +0200 Subject: [PATCH] Returning 403 when you don't have enough permissions --- apps/permission/views.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/permission/views.py b/apps/permission/views.py index 77e5a4d0..6e5bacdf 100644 --- a/apps/permission/views.py +++ b/apps/permission/views.py @@ -35,11 +35,9 @@ class ProtectQuerysetMixin: try: return super().get_object(queryset) except Http404 as e: - try: - super().get_object(self.get_queryset(filter_permissions=False)) - raise PermissionDenied() - except Http404: + if self.get_queryset(filter_permissions=False).count() == self.get_queryset().count(): raise e + raise PermissionDenied() def get_form(self, form_class=None): form = super().get_form(form_class)