mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 03:23:59 +03:00
Merge pull request #5348 from fbidu/4585
Adding a more explicit error message when a view does have a get_queryset method but it returned nothing
This commit is contained in:
commit
08ec276850
|
@ -122,6 +122,9 @@ class DjangoModelPermissions(BasePermission):
|
|||
|
||||
if hasattr(view, 'get_queryset'):
|
||||
queryset = view.get_queryset()
|
||||
assert queryset is not None, (
|
||||
'{}.get_queryset() returned None'.format(view.__class__.__name__)
|
||||
)
|
||||
else:
|
||||
queryset = getattr(view, 'queryset', None)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user