aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/permissions.py
diff options
context:
space:
mode:
authorTom Christie2013-05-16 15:08:12 +0100
committerTom Christie2013-05-16 15:08:12 +0100
commitaff88d15f7a483bca2da120339b1b346aa8b1d4c (patch)
treee90fe6744b3d8f28a90e94768a13c96aa316a7a1 /rest_framework/permissions.py
parentaf88a5b1751da32018e8408eac01a91a5f63f8ce (diff)
downloaddjango-rest-framework-aff88d15f7a483bca2da120339b1b346aa8b1d4c.tar.bz2
Version 2.3.3
Diffstat (limited to 'rest_framework/permissions.py')
-rw-r--r--rest_framework/permissions.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py
index 751f31a7..45fcfd66 100644
--- a/rest_framework/permissions.py
+++ b/rest_framework/permissions.py
@@ -126,6 +126,11 @@ class DjangoModelPermissions(BasePermission):
if model_cls is None and queryset is not None:
model_cls = queryset.model
+ # Workaround to ensure DjangoModelPermissions are not applied
+ # to the root view when using DefaultRouter.
+ if model_cls is None and getattr(view, '_ignore_model_permissions'):
+ return True
+
assert model_cls, ('Cannot apply DjangoModelPermissions on a view that'
' does not have `.model` or `.queryset` property.')