Fixed #15575 -- Corrected handling of pagination in generic views to match documentation and historical behavior. Thanks to Ivan Virabyan for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15820 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2011-03-15 08:24:31 +00:00
parent c966566171
commit 87a100b642
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ class MultipleObjectMixin(object):
raise Http404(_(u"Page is not 'last', nor can it be converted to an int.")) raise Http404(_(u"Page is not 'last', nor can it be converted to an int."))
try: try:
page = paginator.page(page_number) page = paginator.page(page_number)
return (paginator, page, page.object_list, True) return (paginator, page, page.object_list, page.has_other_pages())
except InvalidPage: except InvalidPage:
raise Http404(_(u'Invalid page (%(page_number)s)') % { raise Http404(_(u'Invalid page (%(page_number)s)') % {
'page_number': page_number 'page_number': page_number

View File

@ -46,7 +46,7 @@ class ListViewTests(TestCase):
self.assertIs(res.context['author_list'], res.context['object_list']) self.assertIs(res.context['author_list'], res.context['object_list'])
self.assertEqual(res.context['page_obj'].number, 1) self.assertEqual(res.context['page_obj'].number, 1)
self.assertEqual(res.context['paginator'].num_pages, 1) self.assertEqual(res.context['paginator'].num_pages, 1)
self.assertTrue(res.context['is_paginated']) self.assertFalse(res.context['is_paginated'])
def test_paginated_get_page_by_query_string(self): def test_paginated_get_page_by_query_string(self):
self._make_authors(100) self._make_authors(100)