mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
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
This commit is contained in:
@@ -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')
|
||||
self.assertContains(response, 'my_awesome_inline_scripts.js')
|
||||
|
||||
Reference in New Issue
Block a user