Skip to content

Commit 5fd01d0

Browse files
committed
Adding a more explicit error message when a view does have a get_queryset method but it returned nothing
1 parent fed85bc commit 5fd01d0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rest_framework/permissions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ def has_permission(self, request, view):
122122

123123
if hasattr(view, 'get_queryset'):
124124
queryset = view.get_queryset()
125+
assert queryset is not None, (
126+
'The `.get_queryset()` method from the view did not return anything.'
127+
)
125128
else:
126129
queryset = getattr(view, 'queryset', None)
127130

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy