#18809: MultipleObjectTemplateResponseMixin should handle a generic 
EmptyQuerySet
-------------------------------+--------------------
     Reporter:  benjaoming     |      Owner:  nobody
         Type:  Bug            |     Status:  new
    Component:  Generic views  |    Version:  1.4
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 In get_template_names:

 {{{#!python
         if hasattr(self.object_list, 'model'):
             opts = self.object_list.model._meta
             names.append("%s/%s%s.html" % (opts.app_label,
 opts.object_name.lower(), self.template_name_suffix))
 }}}


 ...it should be verified that self.object_list is not None as it
 apparently may be in some cases where an EmptyQuerySet instance has been
 generated with no relation to its model class.

 On a secondary note, I don't understand why get_template_names is even
 called when I have defined template_name -- seems like bug?

 The work-around is to override get_template_names in your own ListView
 inheritor:

 {{{#!python
     def get_template_names(self):
         # WHY IS THIS CALLED?
         return [self.__class__.template_name]
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18809>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to