summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2010-12-13 13:57:38 +0000
committerJannis Leidel <jannis@leidel.info>2010-12-13 13:57:38 +0000
commit33a6201fdf6d3334dbafcafa117959a8e3af91d6 (patch)
tree3fea77b5abc63c7db2d0abdb92e596c062f2d143 /tests
parent49c2f23ec1b35ef2544653c1dfa93ce144160a4e (diff)
[1.2.X] Fixed #14312 -- Raising an ``IncorrectLookupParameters`` if the page number given to an admin change list exceeds the number of the last page. Thanks, mk.
Backport from trunk (r14889). git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/admin_changelist/tests.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/regressiontests/admin_changelist/tests.py b/tests/regressiontests/admin_changelist/tests.py
index cb16f4b892..96b36f8355 100644
--- a/tests/regressiontests/admin_changelist/tests.py
+++ b/tests/regressiontests/admin_changelist/tests.py
@@ -1,4 +1,5 @@
from django.contrib import admin
+from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.views.main import ChangeList
from django.template import Context, Template
from django.test import TransactionTestCase
@@ -71,6 +72,28 @@ class ChangeListTests(TransactionTestCase):
self.assertFalse('<td>%s</td>' % editable_name_field == -1,
'Failed to find "name" list_editable field in: %s' % table_output)
+ def test_result_list_editable(self):
+ """
+ Regression test for #14312: list_editable with pagination
+ """
+
+ new_parent = Parent.objects.create(name='parent')
+ for i in range(200):
+ new_child = Child.objects.create(name='name %s' % i, parent=new_parent)
+ request = MockRequest()
+ request.GET['p'] = -1 # Anything outside range
+ m = ChildAdmin(Child, admin.site)
+
+ # Test with list_editable fields
+ m.list_display = ['id', 'name', 'parent']
+ m.list_display_links = ['id']
+ m.list_editable = ['name']
+ self.assertRaises(IncorrectLookupParameters, lambda: \
+ ChangeList(request, Child, m.list_display, m.list_display_links,
+ m.list_filter, m.date_hierarchy, m.search_fields,
+ m.list_select_related, m.list_per_page, m.list_editable, m))
+
+
class ChildAdmin(admin.ModelAdmin):
list_display = ['name', 'parent']
def queryset(self, request):