From edb783ec69eb790a936c2cdf4dd4b65c09ca8f89 Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Thu, 15 Feb 2024 10:06:42 +0100 Subject: [PATCH] fix(generic): use custom permission solution in views --- apis_core/generic/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apis_core/generic/views.py b/apis_core/generic/views.py index 25ec58a14..d9f4534f9 100644 --- a/apis_core/generic/views.py +++ b/apis_core/generic/views.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.contrib.auth.mixins import PermissionRequiredMixin from django.views.generic import DetailView from django.views.generic.base import TemplateView @@ -64,6 +65,9 @@ def get_template_names(self): return template_names def get_permission_required(self): + if hasattr(settings, "APIS_VIEW_PASSES_TEST"): + if settings.APIS_VIEW_PASSES_TEST(self): + return [] if hasattr(self, "permission_action_required"): return [permission_fullname(self.permission_action_required, self.model)] return []