1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #9749 - Added hook to ModelAdmin for specifying custom ChangeLists. Thanks to David Larlet and Eric Florenzano.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11910 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel
2009-12-18 10:08:05 +00:00
parent a2ef46316c
commit ca2d64788d
3 changed files with 52 additions and 1 deletions

View File

@@ -1203,6 +1203,33 @@ class AdminActionsTest(TestCase):
self.failUnlessEqual(Subscriber.objects.count(), 2)
class TestCustomChangeList(TestCase):
fixtures = ['admin-views-users.xml']
urlbit = 'admin'
def setUp(self):
result = self.client.login(username='super', password='secret')
self.failUnlessEqual(result, True)
def tearDown(self):
self.client.logout()
def test_custom_changelist(self):
"""
Validate that a custom ChangeList class can be used (#9749)
"""
# Insert some data
post_data = {"name": u"First Gadget"}
response = self.client.post('/test_admin/%s/admin_views/gadget/add/' % self.urlbit, post_data)
self.failUnlessEqual(response.status_code, 302) # redirect somewhere
# Hit the page once to get messages out of the queue message list
response = self.client.get('/test_admin/%s/admin_views/gadget/' % self.urlbit)
# Ensure that that data is still not visible on the page
response = self.client.get('/test_admin/%s/admin_views/gadget/' % self.urlbit)
self.failUnlessEqual(response.status_code, 200)
self.assertNotContains(response, 'First Gadget')
class TestInlineNotEditable(TestCase):
fixtures = ['admin-views-users.xml']