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:
Carlton Gibson 2017-08-22 21:09:11 +02:00 committed by GitHub
commit 08ec276850

View File

@ -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)