mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #19938 -- Consumed iterator only once in paginator's Page
Thanks Joshua Fialkoff for the report.
This commit is contained in:
parent
2ee447fb5f
commit
31f6421b13
2 changed files with 6 additions and 1 deletions
|
@ -297,6 +297,7 @@ class ModelPaginationTests(TestCase):
|
|||
self.assertIsNone(p.object_list._result_cache)
|
||||
self.assertRaises(TypeError, lambda: p['has_previous'])
|
||||
self.assertIsNone(p.object_list._result_cache)
|
||||
self.assertNotIsInstance(p.object_list, list)
|
||||
|
||||
# Make sure slicing the Page object with numbers and slice objects work.
|
||||
self.assertEqual(p[0], Article.objects.get(headline='Article 1'))
|
||||
|
@ -305,3 +306,5 @@ class ModelPaginationTests(TestCase):
|
|||
"<Article: Article 2>",
|
||||
]
|
||||
)
|
||||
# After __getitem__ is called, object_list is a list
|
||||
self.assertIsInstance(p.object_list, list)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue