summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_views/tests.py
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-04-01 03:11:58 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-04-01 03:11:58 +0000
commitf83af07ce39573786919b1e7980f3f4e07528531 (patch)
treef69f81dbfd7be27f08e350004950c12051ec57c8 /tests/regressiontests/admin_views/tests.py
parent1f74e3382fe8704270c4dcba49f2c25a433bfcc8 (diff)
Fixed #7510: the ModelAdmin now uses `self.queryset` instead of the default manager. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_views/tests.py')
-rw-r--r--tests/regressiontests/admin_views/tests.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index bba7f6ac25..2e228743da 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -13,7 +13,7 @@ from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
from django.utils.html import escape
# local test models
-from models import Article, CustomArticle, Section, ModelWithStringPrimaryKey, Person, Persona, FooAccount, BarAccount, Subscriber, ExternalSubscriber, Podcast
+from models import Article, CustomArticle, Section, ModelWithStringPrimaryKey, Person, Persona, FooAccount, BarAccount, Subscriber, ExternalSubscriber, Podcast, EmptyModel
try:
set
@@ -963,3 +963,27 @@ class TestInlineNotEditable(TestCase):
"""
response = self.client.get('/test_admin/admin/admin_views/parent/add/')
self.failUnlessEqual(response.status_code, 200)
+
+
+class AdminCustomQuerysetTest(TestCase):
+ fixtures = ['admin-views-users.xml']
+
+ def setUp(self):
+ self.client.login(username='super', password='secret')
+ self.pks = [EmptyModel.objects.create().id for i in range(3)]
+
+ def test_changelist_view(self):
+ response = self.client.get('/test_admin/admin/admin_views/emptymodel/')
+ for i in self.pks:
+ if i > 1:
+ self.assertContains(response, 'Primary key = %s' % i)
+ else:
+ self.assertNotContains(response, 'Primary key = %s' % i)
+
+ def test_change_view(self):
+ for i in self.pks:
+ response = self.client.get('/test_admin/admin/admin_views/emptymodel/%s/' % i)
+ if i > 1:
+ self.assertEqual(response.status_code, 200)
+ else:
+ self.assertEqual(response.status_code, 404)