aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/permissions.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/permissions.py')
-rw-r--r--rest_framework/permissions.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py
index 14bec42c..d93dba19 100644
--- a/rest_framework/permissions.py
+++ b/rest_framework/permissions.py
@@ -3,7 +3,8 @@ Provides a set of pluggable permission policies.
"""
from __future__ import unicode_literals
from django.http import Http404
-from rest_framework.compat import oauth2_provider_scope, oauth2_constants
+from rest_framework.compat import (get_model_name, oauth2_provider_scope,
+ oauth2_constants)
SAFE_METHODS = ['GET', 'HEAD', 'OPTIONS']
@@ -106,7 +107,7 @@ class DjangoModelPermissions(BasePermission):
"""
kwargs = {
'app_label': model_cls._meta.app_label,
- 'model_name': model_cls._meta.module_name
+ 'model_name': get_model_name(model_cls)
}
return [perm % kwargs for perm in self.perms_map[method]]
@@ -167,7 +168,7 @@ class DjangoObjectPermissions(DjangoModelPermissions):
def get_required_object_permissions(self, method, model_cls):
kwargs = {
'app_label': model_cls._meta.app_label,
- 'model_name': model_cls._meta.module_name
+ 'model_name': get_model_name(model_cls)
}
return [perm % kwargs for perm in self.perms_map[method]]