diff options
| author | Matthew Somerville <matthew-github@dracos.co.uk> | 2013-04-10 11:27:28 +0100 |
|---|---|---|
| committer | Markus Holtermann <info@markusholtermann.eu> | 2013-05-18 14:10:40 +0200 |
| commit | 1c921cfac34daa9c18e4e235e20fa7beb8929f1c (patch) | |
| tree | 98063da94f56bfeb5613a51a3d32b86b30163e54 /django | |
| parent | 9012a9e2000020493b881a5b79cc801c62180796 (diff) | |
Fixed #20235 -- Use self.object_list if object_list not present in get_context_data kwargs.
This is so MultipleObjectMixin can be used in the same way as
SingleObjectMixin.
Diffstat (limited to 'django')
| -rw-r--r-- | django/views/generic/list.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/views/generic/list.py b/django/views/generic/list.py index 08c4bbcda0..1aff3454f4 100644 --- a/django/views/generic/list.py +++ b/django/views/generic/list.py @@ -105,7 +105,7 @@ class MultipleObjectMixin(ContextMixin): """ Get the context for this view. """ - queryset = kwargs.pop('object_list') + queryset = kwargs.pop('object_list', self.object_list) page_size = self.get_paginate_by(queryset) context_object_name = self.get_context_object_name(queryset) if page_size: @@ -149,7 +149,7 @@ class BaseListView(MultipleObjectMixin, View): if is_empty: raise Http404(_("Empty list and '%(class_name)s.allow_empty' is False.") % {'class_name': self.__class__.__name__}) - context = self.get_context_data(object_list=self.object_list) + context = self.get_context_data() return self.render_to_response(context) |
