From aff88d15f7a483bca2da120339b1b346aa8b1d4c Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 16 May 2013 15:08:12 +0100 Subject: Version 2.3.3 --- rest_framework/permissions.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rest_framework/permissions.py') 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.') -- cgit v1.2.3