summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_inlines
diff options
context:
space:
mode:
authorGary Wilson Jr <gary.wilson@gmail.com>2010-03-26 23:38:05 +0000
committerGary Wilson Jr <gary.wilson@gmail.com>2010-03-26 23:38:05 +0000
commit84de614529f2035057d2d518b7ad94febebcc807 (patch)
treee53bffc5096cfecc5f68e65a8dc6a8bf922305e8 /tests/regressiontests/admin_inlines
parent459c71e3320b17bb4e0f3188baf7ca3ff1bd2260 (diff)
Fixed #13174 -- Fixed missing field label for `readonly_fields` when used in `StackedInline`, thanks to benc for the report and ptone for the investigation and initial patch.
* Corrected `InlineAdminForm.__init__` to pass along `model_admin` parameter in `super` call. * Lookup the field label in the form's model, not the `model_admin` model. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12857 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_inlines')
-rw-r--r--tests/regressiontests/admin_inlines/models.py2
-rw-r--r--tests/regressiontests/admin_inlines/tests.py12
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/regressiontests/admin_inlines/models.py b/tests/regressiontests/admin_inlines/models.py
index 9b491eb939..2c6a64dc7a 100644
--- a/tests/regressiontests/admin_inlines/models.py
+++ b/tests/regressiontests/admin_inlines/models.py
@@ -38,11 +38,13 @@ class Holder(models.Model):
class Inner(models.Model):
dummy = models.IntegerField()
holder = models.ForeignKey(Holder)
+ readonly = models.CharField("Inner readonly label", max_length=1)
class InnerInline(admin.StackedInline):
model = Inner
can_delete = False
+ readonly_fields = ('readonly',) # For bug #13174 tests.
class Holder2(models.Model):
diff --git a/tests/regressiontests/admin_inlines/tests.py b/tests/regressiontests/admin_inlines/tests.py
index 9207c5521c..1ac0100b4a 100644
--- a/tests/regressiontests/admin_inlines/tests.py
+++ b/tests/regressiontests/admin_inlines/tests.py
@@ -4,6 +4,7 @@ from django.test import TestCase
from models import Holder, Inner, InnerInline
from models import Holder2, Inner2, Holder3, Inner3
+
class TestInline(TestCase):
fixtures = ['admin-views-users.xml']
@@ -29,6 +30,15 @@ class TestInline(TestCase):
actual = inner_formset.can_delete
self.assertEqual(expected, actual, 'can_delete must be equal')
+ def test_readonly_stacked_inline_label(self):
+ """Bug #13174."""
+ holder = Holder.objects.create(dummy=42)
+ inner = Inner.objects.create(holder=holder, dummy=42, readonly='')
+ response = self.client.get('/test_admin/admin/admin_inlines/holder/%i/'
+ % holder.id)
+ self.assertContains(response, '<label>Inner readonly label:</label>')
+
+
class TestInlineMedia(TestCase):
fixtures = ['admin-views-users.xml']
@@ -63,4 +73,4 @@ class TestInlineMedia(TestCase):
change_url = '/test_admin/admin/admin_inlines/holder2/%i/' % holder.id
response = self.client.get(change_url)
self.assertContains(response, 'my_awesome_admin_scripts.js')
- self.assertContains(response, 'my_awesome_inline_scripts.js') \ No newline at end of file
+ self.assertContains(response, 'my_awesome_inline_scripts.js')