From 8140a3db3e6b95550947a1254cde2ad1ec9d2fc8 Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Fri, 26 Jan 2024 11:48:20 +0100 Subject: [PATCH] fix(generic): the permission string must also contain the app_label --- apis_core/generic/views.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apis_core/generic/views.py b/apis_core/generic/views.py index c1f2fc948..09d6e0bbc 100644 --- a/apis_core/generic/views.py +++ b/apis_core/generic/views.py @@ -52,11 +52,11 @@ def get_template_names(self): def get_permission_required(self): if hasattr(self, "permission_action_required"): - return [ - get_permission_codename( - self.permission_action_required, self.model._meta - ) - ] + permission_codename = get_permission_codename( + self.permission_action_required, self.model._meta + ) + permission = f"{self.model._meta.app_label}.{permission_codename}" + return [permission] return []