summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorBjorn Kristinsson <bjorn@bjornkri.com>2017-10-17 15:22:45 +0200
committerTim Graham <timograham@gmail.com>2017-11-07 18:46:52 -0500
commitac6a4eb9f95138628a7eec76bee91eb067af80a9 (patch)
tree98ce3c7142d05eb9289e361f948c3638b1dfa72e /django
parenta2851f204c6431330042d0343ee99f33449f78e0 (diff)
Fixed #28719 -- Added a helpful exception if MultipleObjectTemplateResponseMixin doesn't generate any template names.
Diffstat (limited to 'django')
-rw-r--r--django/views/generic/list.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/django/views/generic/list.py b/django/views/generic/list.py
index 906e2a6016..6753c1ab22 100644
--- a/django/views/generic/list.py
+++ b/django/views/generic/list.py
@@ -181,7 +181,13 @@ class MultipleObjectTemplateResponseMixin(TemplateResponseMixin):
if hasattr(self.object_list, 'model'):
opts = self.object_list.model._meta
names.append("%s/%s%s.html" % (opts.app_label, opts.model_name, self.template_name_suffix))
-
+ elif not names:
+ raise ImproperlyConfigured(
+ "%(cls)s requires either a 'template_name' attribute "
+ "or a get_queryset() method that returns a QuerySet." % {
+ 'cls': self.__class__.__name__,
+ }
+ )
return names