diff options
| author | Chris Beaven <smileychris@gmail.com> | 2010-12-09 02:34:14 +0000 |
|---|---|---|
| committer | Chris Beaven <smileychris@gmail.com> | 2010-12-09 02:34:14 +0000 |
| commit | ff8711a825ea9bbe98e873d7aa28ce5135528fec (patch) | |
| tree | f79d3b5709879ab83f0cfa459dd53f611872dc09 /django | |
| parent | b37d867929f41a81feb0954023471d7c50081e41 (diff) | |
Fixes #14873 -- A paginated ListView with a List instead of queryset produces an error.
Additional minor change in functionality: the page is now not considered paginated if the objects do not span multiple pages according to the paginator. This will only affect views with a custom paginator method which uses orphans.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14864 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/views/generic/list.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/views/generic/list.py b/django/views/generic/list.py index d90842fedc..22135720ed 100644 --- a/django/views/generic/list.py +++ b/django/views/generic/list.py @@ -32,9 +32,9 @@ class MultipleObjectMixin(object): """ Paginate the queryset, if needed. """ - if queryset.count() > page_size: - paginator = self.get_paginator(queryset, page_size, allow_empty_first_page=self.get_allow_empty()) - page = self.kwargs.get('page', None) or self.request.GET.get('page', 1) + paginator = self.get_paginator(queryset, page_size, allow_empty_first_page=self.get_allow_empty()) + if paginator.num_pages > 1: + page = self.kwargs.get('page') or self.request.GET.get('page') or 1 try: page_number = int(page) except ValueError: |
