Fixed import statement in admin_views test to work with Python 2.3.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10789 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a00be66311
commit
56f3ed7f54
|
@ -13,11 +13,10 @@ from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
|
|
||||||
# local test models
|
# local test models
|
||||||
from models import (Article, BarAccount, CustomArticle, EmptyModel,
|
from models import Article, BarAccount, CustomArticle, EmptyModel, \
|
||||||
ExternalSubscriber, FooAccount, Gallery,
|
ExternalSubscriber, FooAccount, Gallery, ModelWithStringPrimaryKey, \
|
||||||
ModelWithStringPrimaryKey, Person, Persona, Picture,
|
Person, Persona, Picture, Podcast, Section, Subscriber, Vodcast, \
|
||||||
Podcast, Section, Subscriber, Vodcast, Language,
|
Language, Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit
|
||||||
Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
set
|
set
|
||||||
|
@ -1335,11 +1334,11 @@ class AdminInlineTests(TestCase):
|
||||||
self.failUnlessEqual(response.status_code, 302)
|
self.failUnlessEqual(response.status_code, 302)
|
||||||
self.failUnlessEqual(DooHickey.objects.count(), 1)
|
self.failUnlessEqual(DooHickey.objects.count(), 1)
|
||||||
self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1")
|
self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1")
|
||||||
|
|
||||||
# Check that the PK link exists on the rendered form
|
# Check that the PK link exists on the rendered form
|
||||||
response = self.client.get('/test_admin/admin/admin_views/collector/1/')
|
response = self.client.get('/test_admin/admin/admin_views/collector/1/')
|
||||||
self.assertContains(response, 'name="doohickey_set-0-code"')
|
self.assertContains(response, 'name="doohickey_set-0-code"')
|
||||||
|
|
||||||
# Now resave that inline
|
# Now resave that inline
|
||||||
self.post_data['doohickey_set-INITIAL_FORMS'] = "1"
|
self.post_data['doohickey_set-INITIAL_FORMS'] = "1"
|
||||||
self.post_data['doohickey_set-0-code'] = "DH1"
|
self.post_data['doohickey_set-0-code'] = "DH1"
|
||||||
|
@ -1348,7 +1347,7 @@ class AdminInlineTests(TestCase):
|
||||||
self.failUnlessEqual(response.status_code, 302)
|
self.failUnlessEqual(response.status_code, 302)
|
||||||
self.failUnlessEqual(DooHickey.objects.count(), 1)
|
self.failUnlessEqual(DooHickey.objects.count(), 1)
|
||||||
self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1")
|
self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1")
|
||||||
|
|
||||||
# Now modify that inline
|
# Now modify that inline
|
||||||
self.post_data['doohickey_set-INITIAL_FORMS'] = "1"
|
self.post_data['doohickey_set-INITIAL_FORMS'] = "1"
|
||||||
self.post_data['doohickey_set-0-code'] = "DH1"
|
self.post_data['doohickey_set-0-code'] = "DH1"
|
||||||
|
@ -1357,7 +1356,7 @@ class AdminInlineTests(TestCase):
|
||||||
self.failUnlessEqual(response.status_code, 302)
|
self.failUnlessEqual(response.status_code, 302)
|
||||||
self.failUnlessEqual(DooHickey.objects.count(), 1)
|
self.failUnlessEqual(DooHickey.objects.count(), 1)
|
||||||
self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1 Updated")
|
self.failUnlessEqual(DooHickey.objects.all()[0].name, "Doohickey 1 Updated")
|
||||||
|
|
||||||
def test_integer_pk_inline(self):
|
def test_integer_pk_inline(self):
|
||||||
"A model with an integer PK can be saved as inlines. Regression for #10992"
|
"A model with an integer PK can be saved as inlines. Regression for #10992"
|
||||||
# First add a new inline
|
# First add a new inline
|
||||||
|
@ -1367,11 +1366,11 @@ class AdminInlineTests(TestCase):
|
||||||
self.failUnlessEqual(response.status_code, 302)
|
self.failUnlessEqual(response.status_code, 302)
|
||||||
self.failUnlessEqual(Whatsit.objects.count(), 1)
|
self.failUnlessEqual(Whatsit.objects.count(), 1)
|
||||||
self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1")
|
self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1")
|
||||||
|
|
||||||
# Check that the PK link exists on the rendered form
|
# Check that the PK link exists on the rendered form
|
||||||
response = self.client.get('/test_admin/admin/admin_views/collector/1/')
|
response = self.client.get('/test_admin/admin/admin_views/collector/1/')
|
||||||
self.assertContains(response, 'name="whatsit_set-0-index"')
|
self.assertContains(response, 'name="whatsit_set-0-index"')
|
||||||
|
|
||||||
# Now resave that inline
|
# Now resave that inline
|
||||||
self.post_data['whatsit_set-INITIAL_FORMS'] = "1"
|
self.post_data['whatsit_set-INITIAL_FORMS'] = "1"
|
||||||
self.post_data['whatsit_set-0-index'] = "42"
|
self.post_data['whatsit_set-0-index'] = "42"
|
||||||
|
@ -1380,7 +1379,7 @@ class AdminInlineTests(TestCase):
|
||||||
self.failUnlessEqual(response.status_code, 302)
|
self.failUnlessEqual(response.status_code, 302)
|
||||||
self.failUnlessEqual(Whatsit.objects.count(), 1)
|
self.failUnlessEqual(Whatsit.objects.count(), 1)
|
||||||
self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1")
|
self.failUnlessEqual(Whatsit.objects.all()[0].name, "Whatsit 1")
|
||||||
|
|
||||||
# Now modify that inline
|
# Now modify that inline
|
||||||
self.post_data['whatsit_set-INITIAL_FORMS'] = "1"
|
self.post_data['whatsit_set-INITIAL_FORMS'] = "1"
|
||||||
self.post_data['whatsit_set-0-index'] = "42"
|
self.post_data['whatsit_set-0-index'] = "42"
|
||||||
|
|
Loading…
Reference in New Issue