mirror of https://gitlab.crans.org/bde/nk20
Merge branch '404_or_403' into 'main'
fix #65 Returning 403 when you don't have enough permissions See merge request bde/nk20!259
This commit is contained in:
commit
524a3297fc
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue