mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user