diff --git a/django/contrib/admin/static/admin/css/base.css b/django/contrib/admin/static/admin/css/base.css index 49db5025f2..67aa3143a5 100644 --- a/django/contrib/admin/static/admin/css/base.css +++ b/django/contrib/admin/static/admin/css/base.css @@ -187,7 +187,7 @@ p.mini { margin-top: -3px; } -.help, p.help, form p.help { +.help, p.help, form p.help, div.help, form div.help { font-size: 11px; color: #999; } @@ -410,6 +410,9 @@ input, textarea, select, .form-row p, form .button { font-weight: normal; font-size: 13px; } +.form-row div.help { + padding: 2px 3px; +} textarea { vertical-align: top; diff --git a/django/contrib/admin/static/admin/css/forms.css b/django/contrib/admin/static/admin/css/forms.css index 2a21257b6a..fb91a24492 100644 --- a/django/contrib/admin/static/admin/css/forms.css +++ b/django/contrib/admin/static/admin/css/forms.css @@ -83,7 +83,7 @@ form ul.inline li { height: 26px; } -.aligned label + p { +.aligned label + p, .aligned label + div.help { padding: 6px 0; margin-top: 0; margin-bottom: 0; @@ -115,26 +115,32 @@ form .aligned ul.radiolist { padding: 0; } -form .aligned p.help { +form .aligned p.help, +form .aligned div.help { clear: left; margin-top: 0; margin-left: 160px; padding-left: 10px; } -form .aligned label + p.help { +form .aligned label + p.help, +form .aligned label + div.help { margin-left: 0; padding-left: 0; } -form .aligned p.help:last-child { +form .aligned p.help:last-child, +form .aligned div.help:last-child { margin-bottom: 0; padding-bottom: 0; } form .aligned input + p.help, form .aligned textarea + p.help, -form .aligned select + p.help { +form .aligned select + p.help, +form .aligned input + div.help, +form .aligned textarea + div.help, +form .aligned select + div.help { margin-left: 160px; padding-left: 10px; } @@ -156,7 +162,8 @@ form .aligned table p { padding: 0 0 5px 5px; } -.aligned .vCheckboxLabel + p.help { +.aligned .vCheckboxLabel + p.help, +.aligned .vCheckboxLabel + div.help { margin-top: -4px; } @@ -164,7 +171,8 @@ form .aligned table p { width: 610px; } -.checkbox-row p.help { +.checkbox-row p.help, +.checkbox-row div.help { margin-left: 0; padding-left: 0; } @@ -180,14 +188,22 @@ fieldset .field-box { width: 200px; } -form .wide p, form .wide input + p.help { +form .wide p, +form .wide input + p.help, +form .wide input + div.help { margin-left: 200px; } -form .wide p.help { +form .wide p.help, +form .wide div.help { padding-left: 38px; } +form div.help ul { + padding-left: 0; + margin-left: 0; +} + .colM fieldset.wide .vLargeTextField, .colM fieldset.wide .vXMLLargeTextField { width: 450px; } diff --git a/django/contrib/admin/templates/admin/auth/user/change_password.html b/django/contrib/admin/templates/admin/auth/user/change_password.html index ee4dc6d08d..7a47707df9 100644 --- a/django/contrib/admin/templates/admin/auth/user/change_password.html +++ b/django/contrib/admin/templates/admin/auth/user/change_password.html @@ -37,7 +37,7 @@ {{ form.password1.errors }} {{ form.password1.label_tag }} {{ form.password1 }} {% if form.password1.help_text %} -

{{ form.password1.help_text|safe }}

+
{{ form.password1.help_text|safe }}
{% endif %} @@ -45,7 +45,7 @@ {{ form.password2.errors }} {{ form.password2.label_tag }} {{ form.password2 }} {% if form.password2.help_text %} -

{{ form.password2.help_text|safe }}

+
{{ form.password2.help_text|safe }}
{% endif %} diff --git a/django/contrib/admin/templates/admin/includes/fieldset.html b/django/contrib/admin/templates/admin/includes/fieldset.html index c45e731faf..20f86f73b3 100644 --- a/django/contrib/admin/templates/admin/includes/fieldset.html +++ b/django/contrib/admin/templates/admin/includes/fieldset.html @@ -20,7 +20,7 @@ {% endif %} {% endif %} {% if field.field.help_text %} -

{{ field.field.help_text|safe }}

+
{{ field.field.help_text|safe }}
{% endif %} {% endfor %} diff --git a/django/contrib/admin/templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html index cbbf67fbf2..a48017700f 100644 --- a/django/contrib/admin/templates/registration/password_change_form.html +++ b/django/contrib/admin/templates/registration/password_change_form.html @@ -36,7 +36,7 @@ {{ form.new_password1.errors }} {{ form.new_password1.label_tag }} {{ form.new_password1 }} {% if form.new_password1.help_text %} -

{{ form.new_password1.help_text|safe }}

+
{{ form.new_password1.help_text|safe }}
{% endif %} @@ -44,7 +44,7 @@ {{ form.new_password2.errors }} {{ form.new_password2.label_tag }} {{ form.new_password2 }} {% if form.new_password2.help_text %} -

{{ form.new_password2.help_text|safe }}

+
{{ form.new_password2.help_text|safe }}
{% endif %} diff --git a/docs/releases/1.11.txt b/docs/releases/1.11.txt index 49d0516b99..134d3d2515 100644 --- a/docs/releases/1.11.txt +++ b/docs/releases/1.11.txt @@ -494,6 +494,9 @@ Miscellaneous * ETags are now parsed according to the :rfc:`7232` Conditional Requests specification rather than the syntax from :rfc:`2616`. +* In the admin templates, ``

`` is replaced with a ``

`` tag + to allow including lists inside help text. + .. _deprecated-features-1.11: Features deprecated in 1.11 diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py index 03c9a05dbe..5871f16a3b 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -158,7 +158,7 @@ class TestInline(TestDataMixin, TestCase): Ref #8190. """ response = self.client.get(reverse('admin:admin_inlines_holder4_add')) - self.assertContains(response, '

Awesome stacked help text is awesome.

', 4) + self.assertContains(response, '
Awesome stacked help text is awesome.
', 4) self.assertContains( response, '') self.assertContains(response, '
') self.assertContains(response, '
') - self.assertContains(response, '

', 3) + self.assertContains(response, '

', 3) self.assertContains( response, - '

Some help text for the title (with unicode ŠĐĆŽćžšđ)

', + '
Some help text for the title (with unicode ŠĐĆŽćžšđ)
', html=True ) self.assertContains( response, - '

Some help text for the content (with unicode ŠĐĆŽćžšđ)

', + '
Some help text for the content (with unicode ŠĐĆŽćžšđ)
', html=True ) self.assertContains( response, - '

Some help text for the date (with unicode ŠĐĆŽćžšđ)

', + '
Some help text for the date (with unicode ŠĐĆŽćžšđ)
', html=True ) @@ -4724,7 +4724,7 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase): """ p = FieldOverridePost.objects.create(title="Test Post", content="Test Content") response = self.client.get(reverse('admin:admin_views_fieldoverridepost_change', args=(p.pk,))) - self.assertContains(response, '

Overridden help text for the date

') + self.assertContains(response, '
Overridden help text for the date
') self.assertContains(response, '', html=True) self.assertNotContains(response, "Some help text for the date (with unicode ŠĐĆŽćžšđ)") diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 378a9290b7..baf4b8adc6 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -1222,7 +1222,7 @@ class AdminRawIdWidgetSeleniumTests(AdminWidgetSeleniumTestCase): # Help text for the field is displayed self.assertEqual( - self.selenium.find_element_by_css_selector('.field-supporting_bands p.help').text, + self.selenium.find_element_by_css_selector('.field-supporting_bands div.help').text, 'Supporting Bands.' )