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 /tests | |
| 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 'tests')
| -rw-r--r-- | tests/regressiontests/generic_views/list.py | 7 | ||||
| -rw-r--r-- | tests/regressiontests/generic_views/urls.py | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/regressiontests/generic_views/list.py b/tests/regressiontests/generic_views/list.py index bde741ef26..6ed28170a7 100644 --- a/tests/regressiontests/generic_views/list.py +++ b/tests/regressiontests/generic_views/list.py @@ -90,7 +90,7 @@ class ListViewTests(TestCase): self._make_authors(7) res = self.client.get('/list/authors/paginated/custom_class/') self.assertEqual(res.status_code, 200) - self.assertIsInstance(res.context['paginator'], CustomPaginator) + self.assertIsNone(res.context['paginator']) # Custom pagination allows for 2 orphans on a page size of 5 self.assertEqual(len(res.context['object_list']), 7) @@ -101,6 +101,11 @@ class ListViewTests(TestCase): # Custom pagination allows for 2 orphans on a page size of 5 self.assertEqual(len(res.context['object_list']), 7) + def test_paginated_non_queryset(self): + res = self.client.get('/list/dict/paginated/') + self.assertEqual(res.status_code, 200) + self.assertEqual(len(res.context['object_list']), 1) + def test_allow_empty_false(self): res = self.client.get('/list/authors/notempty/') self.assertEqual(res.status_code, 200) diff --git a/tests/regressiontests/generic_views/urls.py b/tests/regressiontests/generic_views/urls.py index db09d63692..037da42d9a 100644 --- a/tests/regressiontests/generic_views/urls.py +++ b/tests/regressiontests/generic_views/urls.py @@ -98,6 +98,8 @@ urlpatterns = patterns('', # ListView (r'^list/dict/$', views.DictList.as_view()), + (r'^list/dict/paginated/$', + views.DictList.as_view(paginate_by=1)), url(r'^list/authors/$', views.AuthorList.as_view(), name="authors_list"), |
