mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 08:14:16 +03:00
Don't raise AttributeError on views with no model or queryset, when using DjangoModelPermissions
This commit is contained in:
parent
da62987b82
commit
6d2ca75d8e
|
@ -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'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user