aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/routers.py
diff options
context:
space:
mode:
authorTom Christie2015-01-30 14:00:25 +0000
committerTom Christie2015-01-30 14:00:25 +0000
commit4ee4b4f2dc3cffd8246772bdf829a2a720493377 (patch)
tree95b514483e901c10bdeee0d66e60430002d5101a /rest_framework/routers.py
parent8f33e39f62c59d06783dd3e6e7cf8d464ff08c5f (diff)
parent7cf9dea7f905ea6869148a68b4fa96cad0a347e8 (diff)
downloaddjango-rest-framework-4ee4b4f2dc3cffd8246772bdf829a2a720493377.tar.bz2
Merge master
Diffstat (limited to 'rest_framework/routers.py')
-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):
"""