MultipleObjectTemplateResponseMixin should handle a generic EmptyQuerySet
|Reported by:||benjaoming||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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:
def get_template_names(self): # WHY IS THIS CALLED? return [self.__class__.template_name]