Fixed #29184 -- Made TabularInline respect model form's Meta.labels and help_texts.

This commit is contained in:
Hasan Ramezani 2018-03-09 01:49:02 +03:30 committed by Tim Graham
parent 3c4ff21763
commit 274e3e27f3
4 changed files with 25 additions and 3 deletions

View file

@ -175,6 +175,21 @@ class TestInline(TestDataMixin, TestCase):
1
)
def test_tabular_model_form_meta_readonly_field(self):
"""
Tabular inlines use ModelForm.Meta.help_texts and labels for read-only
fields.
"""
response = self.client.get(reverse('admin:admin_inlines_someparentmodel_add'))
self.assertContains(
response,
'<img src="/static/admin/img/icon-unknown.svg" '
'class="help help-tooltip" width="10" height="10" '
'alt="(Help text from ModelForm.Meta)" '
'title="Help text from ModelForm.Meta">'
)
self.assertContains(response, 'Label from ModelForm.Meta')
def test_inline_hidden_field_no_column(self):
"""#18263 -- Make sure hidden fields don't get a column in tabular inlines"""
parent = SomeParentModel.objects.create(name='a')