summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_views
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2010-01-12 23:34:03 +0000
committerJannis Leidel <jannis@leidel.info>2010-01-12 23:34:03 +0000
commit31f3a8c1ad3b6ec33c503241484107bf35cdadba (patch)
treeba7751b7fe6b7a6429ee590153927b4c47aed1db /tests/regressiontests/admin_views
parent09b585e4bb250ab75264df129e341a7e731ef3b9 (diff)
Fixed #10640 - Adds a add_form_template option to ModelAdmin. Thanks jcsackett.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12216 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_views')
-rw-r--r--tests/regressiontests/admin_views/models.py1
-rw-r--r--tests/regressiontests/admin_views/tests.py11
2 files changed, 8 insertions, 4 deletions
diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py
index ffdc72620e..384a6d92a6 100644
--- a/tests/regressiontests/admin_views/models.py
+++ b/tests/regressiontests/admin_views/models.py
@@ -110,6 +110,7 @@ class CustomArticleAdmin(admin.ModelAdmin):
"""
change_list_template = 'custom_admin/change_list.html'
change_form_template = 'custom_admin/change_form.html'
+ add_form_template = 'custom_admin/add_form.html'
object_history_template = 'custom_admin/object_history.html'
delete_confirmation_template = 'custom_admin/delete_confirmation.html'
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index c580491486..4d6e1d5139 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -550,11 +550,11 @@ class AdminViewPermissionsTest(TestCase):
self.assert_("var hello = 'Hello!';" in request.content)
self.assertTemplateUsed(request, 'custom_admin/change_list.html')
- # Test custom change form template
+ # Test custom add form template
request = self.client.get('/test_admin/admin/admin_views/customarticle/add/')
- self.assertTemplateUsed(request, 'custom_admin/change_form.html')
+ self.assertTemplateUsed(request, 'custom_admin/add_form.html')
- # Add an article so we can test delete and history views
+ # Add an article so we can test delete, change, and history views
post = self.client.post('/test_admin/admin/admin_views/customarticle/add/', {
'content': '<p>great article</p>',
'date_0': '2008-03-18',
@@ -563,7 +563,10 @@ class AdminViewPermissionsTest(TestCase):
self.assertRedirects(post, '/test_admin/admin/admin_views/customarticle/')
self.failUnlessEqual(CustomArticle.objects.all().count(), 1)
- # Test custom delete and object history templates
+ # Test custom delete, change, and object history templates
+ # Test custom change form template
+ request = self.client.get('/test_admin/admin/admin_views/customarticle/1/')
+ self.assertTemplateUsed(request, 'custom_admin/change_form.html')
request = self.client.get('/test_admin/admin/admin_views/customarticle/1/delete/')
self.assertTemplateUsed(request, 'custom_admin/delete_confirmation.html')
request = self.client.get('/test_admin/admin/admin_views/customarticle/1/history/')