aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework
diff options
context:
space:
mode:
authorTymur Maryokhin2015-01-29 17:28:03 +0100
committerTymur Maryokhin2015-01-29 17:28:03 +0100
commitba7dca893cd55a1d5ee928c4b10878c92c44c4f5 (patch)
tree20740a900cd8da251730a204c8a572beaaa61fac /rest_framework
parent60a63ffd2926f2e88dfa91fffa87b7aa0c1d73dd (diff)
downloaddjango-rest-framework-ba7dca893cd55a1d5ee928c4b10878c92c44c4f5.tar.bz2
Removed router check for deprecated '.model' attribute
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):
"""