mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Fixed #35755 -- Hid help text of hidden fields in admin fieldsets.
Regression in 96a598356a
.
This commit is contained in:
parent
b2501759eb
commit
16af0c60ed
@ -27,7 +27,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if field.field.help_text %}
|
||||
<div class="help"{% if field.field.id_for_label %} id="{{ field.field.id_for_label }}_helptext"{% endif %}>
|
||||
<div class="help{% if field.field.is_hidden %} hidden{% endif %}"{% if field.field.id_for_label %} id="{{ field.field.id_for_label }}_helptext"{% endif %}>
|
||||
<div>{{ field.field.help_text|safe }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -332,7 +332,7 @@ class SomeParentModel(models.Model):
|
||||
|
||||
class SomeChildModel(models.Model):
|
||||
name = models.CharField(max_length=1)
|
||||
position = models.PositiveIntegerField()
|
||||
position = models.PositiveIntegerField(help_text="Position help_text.")
|
||||
parent = models.ForeignKey(SomeParentModel, models.CASCADE)
|
||||
readonly_field = models.CharField(max_length=1)
|
||||
|
||||
|
@ -349,7 +349,12 @@ class TestInline(TestDataMixin, TestCase):
|
||||
)
|
||||
response = self.client.get(url)
|
||||
self.assertInHTML(
|
||||
'<th class="column-position hidden">Position</th>',
|
||||
'<th class="column-position hidden">Position'
|
||||
'<img src="/static/admin/img/icon-unknown.svg" '
|
||||
'class="help help-tooltip" width="10" height="10" '
|
||||
'alt="(Position help_text.)" '
|
||||
'title="Position help_text.">'
|
||||
"</th>",
|
||||
response.rendered_content,
|
||||
)
|
||||
self.assertInHTML(
|
||||
@ -379,13 +384,15 @@ class TestInline(TestDataMixin, TestCase):
|
||||
self.assertInHTML(
|
||||
'<div class="flex-container fieldBox field-position hidden">'
|
||||
'<label class="inline">Position:</label>'
|
||||
'<div class="readonly">0</div></div>',
|
||||
'<div class="readonly">0</div></div>'
|
||||
'<div class="help hidden"><div>Position help_text.</div></div>',
|
||||
response.rendered_content,
|
||||
)
|
||||
self.assertInHTML(
|
||||
'<div class="flex-container fieldBox field-position hidden">'
|
||||
'<label class="inline">Position:</label>'
|
||||
'<div class="readonly">1</div></div>',
|
||||
'<div class="readonly">1</div></div>'
|
||||
'<div class="help hidden"><div>Position help_text.</div></div>',
|
||||
response.rendered_content,
|
||||
)
|
||||
|
||||
@ -407,13 +414,17 @@ class TestInline(TestDataMixin, TestCase):
|
||||
self.assertInHTML(
|
||||
'<div class="form-row hidden field-position">'
|
||||
'<div><div class="flex-container"><label>Position:</label>'
|
||||
'<div class="readonly">0</div></div></div></div>',
|
||||
'<div class="readonly">0</div></div>'
|
||||
'<div class="help hidden"><div>Position help_text.</div></div>'
|
||||
"</div></div>",
|
||||
response.rendered_content,
|
||||
)
|
||||
self.assertInHTML(
|
||||
'<div class="form-row hidden field-position">'
|
||||
'<div><div class="flex-container"><label>Position:</label>'
|
||||
'<div class="readonly">1</div></div></div></div>',
|
||||
'<div class="readonly">1</div></div>'
|
||||
'<div class="help hidden"><div>Position help_text.</div></div>'
|
||||
"</div></div>",
|
||||
response.rendered_content,
|
||||
)
|
||||
|
||||
@ -448,7 +459,12 @@ class TestInline(TestDataMixin, TestCase):
|
||||
self.assertInHTML(
|
||||
'<thead><tr><th class="original"></th>'
|
||||
'<th class="column-name required">Name</th>'
|
||||
'<th class="column-position required hidden">Position</th>'
|
||||
'<th class="column-position required hidden">Position'
|
||||
'<img src="/static/admin/img/icon-unknown.svg" '
|
||||
'class="help help-tooltip" width="10" height="10" '
|
||||
'alt="(Position help_text.)" '
|
||||
'title="Position help_text.">'
|
||||
"</th>"
|
||||
"<th>Delete?</th></tr></thead>",
|
||||
response.rendered_content,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user