mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Merge a3e44fd372
into 8f6173cd8a
This commit is contained in:
commit
14db6755d5
|
@ -134,12 +134,14 @@ class SimpleRouter(BaseRouter):
|
|||
If `base_name` is not specified, attempt to automatically determine
|
||||
it from the viewset.
|
||||
"""
|
||||
if hasattr(viewset, 'get_queryset'):
|
||||
queryset = viewset().get_queryset()
|
||||
else:
|
||||
queryset = getattr(viewset, 'queryset', None)
|
||||
|
||||
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()
|
||||
|
||||
def get_routes(self, viewset):
|
||||
|
|
Loading…
Reference in New Issue
Block a user