Commit 6d2ca75d by Tom Christie

Don't raise AttributeError on views with no model or queryset, when using DjangoModelPermissions

parent da62987b
...@@ -128,7 +128,7 @@ class DjangoModelPermissions(BasePermission): ...@@ -128,7 +128,7 @@ class DjangoModelPermissions(BasePermission):
# Workaround to ensure DjangoModelPermissions are not applied # Workaround to ensure DjangoModelPermissions are not applied
# to the root view when using DefaultRouter. # to the root view when using DefaultRouter.
if model_cls is None and getattr(view, '_ignore_model_permissions'): if model_cls is None and getattr(view, '_ignore_model_permissions', False):
return True return True
assert model_cls, ('Cannot apply DjangoModelPermissions on a view that' assert model_cls, ('Cannot apply DjangoModelPermissions on a view that'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment