#28719: Better exception message when get_queryset returns None
---------------------------------------------+------------------------
               Reporter:  Bjorn Kristinsson  |          Owner:  nobody
                   Type:  Bug                |         Status:  new
              Component:  Generic views      |        Version:  master
               Severity:  Normal             |       Keywords:
           Triage Stage:  Unreviewed         |      Has patch:  1
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  1
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 One of my `ListViews` suddenly started raising `TemplateDoesNotExist` with
 a rather cryptic (to me) message:

 {{{
 Template-loader postmortem

 Django tried loading these templates, in this order:

 Using engine :
 This engine did not provide a list of tried templates.
 }}}

 It took me a while to realise this was because my get_queryset wasn't
 returning anything. It did some filtering based on user settings, and I
 didn't have a fallback for when none of the filtering steps applied.

 Thought it might be helpful to have a better message is no template names
 are found and `object_list` is `None`. Suggesting: "Expected a queryset,
 but found None. Please check that <cls>.get_queryset() returns a
 queryset." Pull request coming up.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28719>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.86ab5971f43dfd09738812efe65f0fdd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to