From 6f2c3bcb1287db58a191ab7ee4d9723a3377e716 Mon Sep 17 00:00:00 2001 From: Felipe Bidu Date: Tue, 22 Aug 2017 12:13:22 -0300 Subject: [PATCH] Further clarifying the message when get_queryset returns None to include the class name that was called --- rest_framework/permissions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 484630ae7..01b74e877 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -123,7 +123,7 @@ class DjangoModelPermissions(BasePermission): if hasattr(view, 'get_queryset'): queryset = view.get_queryset() assert queryset is not None, ( - 'The `.get_queryset()` method from the view did not return anything.' + 'Return of {}.get_queryset() was None'.format(view.__class__.__name__) ) else: queryset = getattr(view, 'queryset', None)