diff options
| author | Tom Christie | 2014-08-20 17:15:46 +0100 | 
|---|---|---|
| committer | Tom Christie | 2014-08-20 17:15:46 +0100 | 
| commit | 4d8c63abc996bcb44d7a68dd7a7234b0d9f148a0 (patch) | |
| tree | 15d175ba67d1a8ef0f1f651a82120ac9263d7d72 /rest_framework | |
| parent | 9372cc8c31fc5d7b3fb3b155ed88b0b6d3c00049 (diff) | |
| download | django-rest-framework-4d8c63abc996bcb44d7a68dd7a7234b0d9f148a0.tar.bz2 | |
Deprecate .model in related routers/permissions
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/permissions.py | 3 | ||||
| -rw-r--r-- | rest_framework/routers.py | 5 | 
2 files changed, 7 insertions, 1 deletions
diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 6a1a0077..29f60d6d 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -108,6 +108,9 @@ class DjangoModelPermissions(BasePermission):          return [perm % kwargs for perm in self.perms_map[method]]      def has_permission(self, request, view): +        # Note that `.model` attribute on views is deprecated, although we +        # enforce the deprecation on the view `get_serializer_class()` and +        # `get_queryset()` methods, rather than here.          model_cls = getattr(view, 'model', None)          queryset = getattr(view, 'queryset', None) diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 406ebcf7..ae56673d 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -128,6 +128,9 @@ class SimpleRouter(BaseRouter):          If `base_name` is not specified, attempt to automatically determine          it from the viewset.          """ +        # Note that `.model` attribute on views is deprecated, although we +        # enforce the deprecation on the view `get_serializer_class()` and +        # `get_queryset()` methods, rather than here.          model_cls = getattr(viewset, 'model', None)          queryset = getattr(viewset, 'queryset', None)          if model_cls is None and queryset is not None: @@ -135,7 +138,7 @@ class SimpleRouter(BaseRouter):          assert model_cls, '`base_name` argument not specified, and could ' \              'not automatically determine the name from the viewset, as ' \ -            'it does not have a `.model` or `.queryset` attribute.' +            'it does not have a `.queryset` attribute.'          return model_cls._meta.object_name.lower()  | 
