From c040564dc232fd97e048e1070c5fd56a755a63cc Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 20 Dec 2022 13:47:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=98=BE=E7=A4=BA=20m?= =?UTF-8?q?odel=20=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/rbac/permissions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/rbac/permissions.py b/apps/rbac/permissions.py index 3b59a4812..1feade002 100644 --- a/apps/rbac/permissions.py +++ b/apps/rbac/permissions.py @@ -93,8 +93,10 @@ class RBACPermission(permissions.DjangoModelPermissions): try: queryset = self._queryset(view) model_cls = queryset.model + except AssertionError: + model_cls = None except Exception as e: - logger.error(e) + logger.error('Error get model class: {} of {}'.format(e, view)) model_cls = None return model_cls