Routers will now be using get_queryset

This commit is contained in:
aswinm 2016-10-17 21:32:39 +05:30
parent a83997e1ed
commit d041a4fb1c

View File

@ -135,11 +135,7 @@ class SimpleRouter(BaseRouter):
If `base_name` is not specified, attempt to automatically determine If `base_name` is not specified, attempt to automatically determine
it from the viewset. it from the viewset.
""" """
queryset = getattr(viewset, 'queryset', None) queryset = viewset().get_queryset()
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 queryset.model._meta.object_name.lower() return queryset.model._meta.object_name.lower()