aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework
diff options
context:
space:
mode:
authorTom Christie2015-01-29 21:25:07 +0000
committerTom Christie2015-01-29 21:25:07 +0000
commit2a43d9db87f92097bbc8720c3fc8f8a1dfba5a94 (patch)
treecbc175154ae21c78ed20d9bdc436707564ee9e5d /rest_framework
parent60a63ffd2926f2e88dfa91fffa87b7aa0c1d73dd (diff)
parente720927b78a31999f03bfa248329d623ce2c045c (diff)
downloaddjango-rest-framework-2a43d9db87f92097bbc8720c3fc8f8a1dfba5a94.tar.bz2
Merge pull request #2486 from maryokhin/master
Cleanup '.model' shortcut from code and docs
Diffstat (limited to 'rest_framework')
-rw-r--r--rest_framework/routers.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/rest_framework/routers.py b/rest_framework/routers.py
index 827da034..6a4184e2 100644
--- a/rest_framework/routers.py
+++ b/rest_framework/routers.py
@@ -130,19 +130,13 @@ 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:
- model_cls = queryset.model
- assert model_cls, '`base_name` argument not specified, and could ' \
+ assert queryset is not None, '`base_name` argument not specified, and could ' \
'not automatically determine the name from the viewset, as ' \
'it does not have a `.queryset` attribute.'
- return model_cls._meta.object_name.lower()
+ return queryset.model._meta.object_name.lower()
def get_routes(self, viewset):
"""