Skip to content

Commit 6d2ca75

Browse files
committed
Don't raise AttributeError on views with no model or queryset, when using DjangoModelPermissions
1 parent da62987 commit 6d2ca75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rest_framework/permissions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def has_permission(self, request, view):
128128

129129
# Workaround to ensure DjangoModelPermissions are not applied
130130
# to the root view when using DefaultRouter.
131-
if model_cls is None and getattr(view, '_ignore_model_permissions'):
131+
if model_cls is None and getattr(view, '_ignore_model_permissions', False):
132132
return True
133133

134134
assert model_cls, ('Cannot apply DjangoModelPermissions on a view that'

0 commit comments

Comments
 (0)