From ff05de760cc4ef4c7f188e163c722ec3bc1f0cbf Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 20 Jan 2018 23:09:10 -0800 Subject: [PATCH] Fixed #29038 -- Removed closing slash from HTML void tags. --- django/contrib/admin/options.py | 2 +- .../admin/auth/user/change_password.html | 8 +- .../contrib/admin/templates/admin/base.html | 12 +- .../admin/templates/admin/change_form.html | 6 +- .../admin/templates/admin/change_list.html | 4 +- .../admin/templates/admin/date_hierarchy.html | 2 +- .../templates/admin/delete_confirmation.html | 8 +- .../admin/delete_selected_confirmation.html | 8 +- .../templates/admin/edit_inline/tabular.html | 2 +- .../contrib/admin/templates/admin/index.html | 4 +- .../contrib/admin/templates/admin/login.html | 6 +- .../admin/templates/admin/pagination.html | 2 +- .../admin/related_widget_wrapper.html | 6 +- .../admin/templates/admin/search_form.html | 8 +- .../admin/templates/admin/submit_line.html | 8 +- .../admin/widgets/clearable_file_input.html | 6 +- .../admin/widgets/related_widget_wrapper.html | 6 +- .../admin/widgets/split_datetime.html | 2 +- .../admin/templates/admin/widgets/url.html | 2 +- .../registration/password_change_form.html | 4 +- .../registration/password_reset_confirm.html | 4 +- .../registration/password_reset_form.html | 4 +- .../contrib/admin/templatetags/admin_list.py | 2 +- .../admin_doc/template_filter_index.html | 4 +- .../admin_doc/template_tag_index.html | 4 +- .../templates/admin_doc/view_index.html | 2 +- django/forms/forms.py | 2 +- .../forms/widgets/clearable_file_input.html | 6 +- .../jinja2/django/forms/widgets/input.html | 2 +- .../forms/widgets/clearable_file_input.html | 6 +- .../templates/django/forms/widgets/input.html | 2 +- django/forms/widgets.py | 2 +- django/template/backends/utils.py | 2 +- django/template/defaultfilters.py | 6 +- django/template/defaulttags.py | 4 +- django/test/html.py | 2 +- django/utils/html.py | 6 +- django/views/static.py | 6 +- docs/howto/static-files/index.txt | 2 +- docs/intro/contributing.txt | 4 +- docs/intro/overview.txt | 2 +- docs/intro/tutorial04.txt | 6 +- docs/intro/tutorial06.txt | 2 +- .../ref/class-based-views/generic-editing.txt | 8 +- docs/ref/contrib/admin/index.txt | 2 +- docs/ref/forms/api.txt | 222 ++--- docs/ref/forms/fields.txt | 50 +- docs/ref/forms/widgets.txt | 34 +- docs/ref/request-response.txt | 2 +- docs/ref/templates/builtins.txt | 22 +- docs/ref/templates/language.txt | 4 +- docs/releases/2.1.txt | 4 + docs/topics/auth/default.txt | 4 +- docs/topics/forms/formsets.txt | 66 +- docs/topics/forms/index.txt | 10 +- docs/topics/forms/media.txt | 32 +- docs/topics/forms/modelforms.txt | 14 +- docs/topics/i18n/timezones.txt | 2 +- docs/topics/i18n/translation.txt | 12 +- docs/topics/pagination.txt | 2 +- docs/topics/testing/tools.txt | 2 +- tests/admin_changelist/tests.py | 6 +- tests/admin_docs/test_views.py | 2 +- tests/admin_inlines/tests.py | 70 +- tests/admin_utils/tests.py | 6 +- tests/admin_views/tests.py | 26 +- tests/admin_widgets/tests.py | 56 +- tests/csrf_tests/views.py | 2 +- .../forms_tests/field_tests/test_charfield.py | 2 +- .../forms_tests/field_tests/test_datefield.py | 2 +- .../field_tests/test_decimalfield.py | 8 +- .../field_tests/test_emailfield.py | 4 +- .../field_tests/test_floatfield.py | 8 +- .../field_tests/test_integerfield.py | 10 +- .../field_tests/test_multivaluefield.py | 12 +- .../field_tests/test_nullbooleanfield.py | 4 +- .../forms_tests/field_tests/test_urlfield.py | 4 +- tests/forms_tests/tests/test_forms.py | 844 +++++++++--------- tests/forms_tests/tests/test_formsets.py | 206 ++--- tests/forms_tests/tests/test_i18n.py | 18 +- tests/forms_tests/tests/test_media.py | 112 +-- tests/forms_tests/tests/tests.py | 30 +- .../widget_tests/test_checkboxinput.py | 22 +- .../test_checkboxselectmultiple.py | 66 +- .../widget_tests/test_clearablefileinput.py | 26 +- .../widget_tests/test_dateinput.py | 12 +- .../widget_tests/test_datetimeinput.py | 16 +- .../widget_tests/test_fileinput.py | 6 +- .../widget_tests/test_hiddeninput.py | 2 +- tests/forms_tests/widget_tests/test_input.py | 6 +- .../widget_tests/test_multiplehiddeninput.py | 26 +- .../widget_tests/test_multiwidget.py | 34 +- .../widget_tests/test_numberinput.py | 2 +- .../widget_tests/test_passwordinput.py | 10 +- .../widget_tests/test_radioselect.py | 54 +- .../widget_tests/test_splitdatetimewidget.py | 24 +- .../test_splithiddendatetimewidget.py | 22 +- .../widget_tests/test_textinput.py | 24 +- .../widget_tests/test_timeinput.py | 14 +- tests/forms_tests/widget_tests/test_widget.py | 4 +- tests/generic_relations/test_forms.py | 32 +- tests/i18n/tests.py | 22 +- tests/model_forms/tests.py | 116 +-- tests/model_formsets/tests.py | 240 ++--- tests/postgres_tests/test_array.py | 14 +- tests/postgres_tests/test_ranges.py | 20 +- tests/staticfiles_tests/test_forms.py | 4 +- tests/template_backends/test_dummy.py | 2 +- .../filter_tests/test_linebreaks.py | 16 +- .../filter_tests/test_linebreaksbr.py | 14 +- tests/templates/login.html | 4 +- tests/utils_tests/test_html.py | 4 +- 112 files changed, 1487 insertions(+), 1483 deletions(-) diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 1c27dc400bc..268ce012d16 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -809,7 +809,7 @@ class ModelAdmin(BaseModelAdmin): A list_display column containing a checkbox widget. """ return helpers.checkbox.render(helpers.ACTION_CHECKBOX_NAME, str(obj.pk)) - action_checkbox.short_description = mark_safe('') + action_checkbox.short_description = mark_safe('') def get_actions(self, request): """ 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 7a47707df92..4b3bfb920cc 100644 --- a/django/contrib/admin/templates/admin/auth/user/change_password.html +++ b/django/contrib/admin/templates/admin/auth/user/change_password.html @@ -5,7 +5,7 @@ {% block extrahead %}{{ block.super }} {% endblock %} -{% block extrastyle %}{{ block.super }}{% endblock %} +{% block extrastyle %}{{ block.super }}{% endblock %} {% block bodyclass %}{{ block.super }} {{ opts.app_label }}-{{ opts.model_name }} change-form{% endblock %} {% if not is_popup %} {% block breadcrumbs %} @@ -20,9 +20,9 @@ {% endif %} {% block content %}
{% csrf_token %}{% block form_top %}{% endblock %} - +
-{% if is_popup %}{% endif %} +{% if is_popup %}{% endif %} {% if form.errors %}

{% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} @@ -52,7 +52,7 @@

- +
diff --git a/django/contrib/admin/templates/admin/base.html b/django/contrib/admin/templates/admin/base.html index c4c7ca85c6e..2cf5137070d 100644 --- a/django/contrib/admin/templates/admin/base.html +++ b/django/contrib/admin/templates/admin/base.html @@ -3,16 +3,16 @@ {% block title %}{% endblock %} - + {% block extrastyle %}{% endblock %} -{% if LANGUAGE_BIDI %}{% endif %} +{% if LANGUAGE_BIDI %}{% endif %} {% block extrahead %}{% endblock %} {% block responsive %} - - {% if LANGUAGE_BIDI %}{% endif %} + + {% if LANGUAGE_BIDI %}{% endif %} {% endblock %} -{% block blockbots %}{% endblock %} +{% block blockbots %}{% endblock %} {% load i18n %} @@ -81,7 +81,7 @@ {{ content }} {% endblock %} {% block sidebar %}{% endblock %} -
+
diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index fd0b130b2d1..f77e50a1304 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -6,7 +6,7 @@ {{ media }} {% endblock %} -{% block extrastyle %}{{ block.super }}{% endblock %} +{% block extrastyle %}{{ block.super }}{% endblock %} {% block coltype %}colM{% endblock %} @@ -39,8 +39,8 @@ {% endblock %} {% csrf_token %}{% block form_top %}{% endblock %}
-{% if is_popup %}{% endif %} -{% if to_field %}{% endif %} +{% if is_popup %}{% endif %} +{% if to_field %}{% endif %} {% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %} {% if errors %}

diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html index e0af704aa98..34a40317999 100644 --- a/django/contrib/admin/templates/admin/change_list.html +++ b/django/contrib/admin/templates/admin/change_list.html @@ -3,9 +3,9 @@ {% block extrastyle %} {{ block.super }} - + {% if cl.formset %} - + {% endif %} {% if cl.formset or action_form %} diff --git a/django/contrib/admin/templates/admin/date_hierarchy.html b/django/contrib/admin/templates/admin/date_hierarchy.html index 005851051cd..ecbd2a1a00c 100644 --- a/django/contrib/admin/templates/admin/date_hierarchy.html +++ b/django/contrib/admin/templates/admin/date_hierarchy.html @@ -5,6 +5,6 @@ {% for choice in choices %}

  • {% if choice.link %}{% endif %}{{ choice.title }}{% if choice.link %}{% endif %}
  • {% endfor %} -
    +
    {% endif %} diff --git a/django/contrib/admin/templates/admin/delete_confirmation.html b/django/contrib/admin/templates/admin/delete_confirmation.html index 2dedc84491d..c28a87cd9b0 100644 --- a/django/contrib/admin/templates/admin/delete_confirmation.html +++ b/django/contrib/admin/templates/admin/delete_confirmation.html @@ -41,10 +41,10 @@ {% csrf_token %}
    - - {% if is_popup %}{% endif %} - {% if to_field %}{% endif %} - + + {% if is_popup %}{% endif %} + {% if to_field %}{% endif %} + {% trans "No, take me back" %}
    diff --git a/django/contrib/admin/templates/admin/delete_selected_confirmation.html b/django/contrib/admin/templates/admin/delete_selected_confirmation.html index 6ae53fecd30..4d77ae33a05 100644 --- a/django/contrib/admin/templates/admin/delete_selected_confirmation.html +++ b/django/contrib/admin/templates/admin/delete_selected_confirmation.html @@ -43,11 +43,11 @@
    {% csrf_token %}
    {% for obj in queryset %} - + {% endfor %} - - - + + + {% trans "No, take me back" %}
    diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html index f04faadf2ff..2f449d67afe 100644 --- a/django/contrib/admin/templates/admin/edit_inline/tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline/tabular.html @@ -13,7 +13,7 @@ {% for field in inline_admin_formset.fields %} {% if not field.widget.is_hidden %} {{ field.label|capfirst }} - {% if field.help_text %} ({{ field.help_text|striptags }}){% endif %} + {% if field.help_text %} ({{ field.help_text|striptags }}){% endif %} {% endif %} {% endfor %} diff --git a/django/contrib/admin/templates/admin/index.html b/django/contrib/admin/templates/admin/index.html index 5a4b1271782..03383db8eaf 100644 --- a/django/contrib/admin/templates/admin/index.html +++ b/django/contrib/admin/templates/admin/index.html @@ -1,7 +1,7 @@ {% extends "admin/base_site.html" %} {% load i18n static %} -{% block extrastyle %}{{ block.super }}{% endblock %} +{% block extrastyle %}{{ block.super }}{% endblock %} {% block coltype %}colMS{% endblock %} @@ -67,7 +67,7 @@ {% else %} {{ entry.object_repr }} {% endif %} -
    +
    {% if entry.content_type %} {% filter capfirst %}{{ entry.content_type }}{% endfilter %} {% else %} diff --git a/django/contrib/admin/templates/admin/login.html b/django/contrib/admin/templates/admin/login.html index 397eadf4a22..396be276f91 100644 --- a/django/contrib/admin/templates/admin/login.html +++ b/django/contrib/admin/templates/admin/login.html @@ -1,7 +1,7 @@ {% extends "admin/base_site.html" %} {% load i18n static %} -{% block extrastyle %}{{ block.super }} +{% block extrastyle %}{{ block.super }} {{ form.media }} {% endblock %} @@ -49,7 +49,7 @@
    {{ form.password.errors }} {{ form.password.label_tag }} {{ form.password }} - +
    {% url 'admin_password_reset' as password_reset_url %} {% if password_reset_url %} @@ -58,7 +58,7 @@ {% endif %}
    - +
    diff --git a/django/contrib/admin/templates/admin/pagination.html b/django/contrib/admin/templates/admin/pagination.html index fc1e600805b..bef843a4449 100644 --- a/django/contrib/admin/templates/admin/pagination.html +++ b/django/contrib/admin/templates/admin/pagination.html @@ -8,5 +8,5 @@ {% endif %} {{ cl.result_count }} {% if cl.result_count == 1 %}{{ cl.opts.verbose_name }}{% else %}{{ cl.opts.verbose_name_plural }}{% endif %} {% if show_all_url %}  {% trans 'Show all' %}{% endif %} -{% if cl.formset and cl.result_count %}{% endif %} +{% if cl.formset and cl.result_count %}{% endif %}

    diff --git a/django/contrib/admin/templates/admin/related_widget_wrapper.html b/django/contrib/admin/templates/admin/related_widget_wrapper.html index af17be81113..7b0a8093929 100644 --- a/django/contrib/admin/templates/admin/related_widget_wrapper.html +++ b/django/contrib/admin/templates/admin/related_widget_wrapper.html @@ -7,21 +7,21 @@ - {% trans 'Change' %} + {% trans 'Change' %} {% endif %} {% if can_add_related %} - {% trans 'Add' %} + {% trans 'Add' %} {% endif %} {% if can_delete_related %} - {% trans 'Delete' %} + {% trans 'Delete' %} {% endif %} {% endspaceless %} diff --git a/django/contrib/admin/templates/admin/search_form.html b/django/contrib/admin/templates/admin/search_form.html index 1417c1f599b..3bb5cba52c4 100644 --- a/django/contrib/admin/templates/admin/search_form.html +++ b/django/contrib/admin/templates/admin/search_form.html @@ -2,14 +2,14 @@ {% if cl.search_fields %}
    diff --git a/django/contrib/admin/templates/admin/submit_line.html b/django/contrib/admin/templates/admin/submit_line.html index d6db711953b..2e6cf057f00 100644 --- a/django/contrib/admin/templates/admin/submit_line.html +++ b/django/contrib/admin/templates/admin/submit_line.html @@ -1,11 +1,11 @@ {% load i18n admin_urls %}
    -{% if show_save %}{% endif %} +{% if show_save %}{% endif %} {% if show_delete_link %} {% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %} {% endif %} -{% if show_save_as_new %}{% endif %} -{% if show_save_and_add_another %}{% endif %} -{% if show_save_and_continue %}{% endif %} +{% if show_save_as_new %}{% endif %} +{% if show_save_and_add_another %}{% endif %} +{% if show_save_and_continue %}{% endif %}
    diff --git a/django/contrib/admin/templates/admin/widgets/clearable_file_input.html b/django/contrib/admin/templates/admin/widgets/clearable_file_input.html index 71491fca451..80699d1a50c 100644 --- a/django/contrib/admin/templates/admin/widgets/clearable_file_input.html +++ b/django/contrib/admin/templates/admin/widgets/clearable_file_input.html @@ -1,6 +1,6 @@ {% if widget.is_initial %}

    {{ widget.initial_text }}: {{ widget.value }}{% if not widget.required %} - -{% endif %}
    + +{% endif %}
    {{ widget.input_text }}:{% endif %} -{% if widget.is_initial %}

    {% endif %} +{% if widget.is_initial %}

    {% endif %} diff --git a/django/contrib/admin/templates/admin/widgets/related_widget_wrapper.html b/django/contrib/admin/templates/admin/widgets/related_widget_wrapper.html index b84ab14cca6..281d3314437 100644 --- a/django/contrib/admin/templates/admin/widgets/related_widget_wrapper.html +++ b/django/contrib/admin/templates/admin/widgets/related_widget_wrapper.html @@ -7,21 +7,21 @@ - {% trans 'Change' %} + {% trans 'Change' %} {% endif %} {% if can_add_related %} - {% trans 'Add' %} + {% trans 'Add' %} {% endif %} {% if can_delete_related %} - {% trans 'Delete' %} + {% trans 'Delete' %} {% endif %} {% endspaceless %} diff --git a/django/contrib/admin/templates/admin/widgets/split_datetime.html b/django/contrib/admin/templates/admin/widgets/split_datetime.html index 985f82d0abb..7fc7bf68339 100644 --- a/django/contrib/admin/templates/admin/widgets/split_datetime.html +++ b/django/contrib/admin/templates/admin/widgets/split_datetime.html @@ -1,4 +1,4 @@

    - {{ date_label }} {% with widget=widget.subwidgets.0 %}{% include widget.template_name %}{% endwith %}
    + {{ date_label }} {% with widget=widget.subwidgets.0 %}{% include widget.template_name %}{% endwith %}
    {{ time_label }} {% with widget=widget.subwidgets.1 %}{% include widget.template_name %}{% endwith %}

    diff --git a/django/contrib/admin/templates/admin/widgets/url.html b/django/contrib/admin/templates/admin/widgets/url.html index 554a9343fea..ee1a66a35f1 100644 --- a/django/contrib/admin/templates/admin/widgets/url.html +++ b/django/contrib/admin/templates/admin/widgets/url.html @@ -1 +1 @@ -{% if widget.value %}

    {{ current_label }} {{ widget.value }}
    {{ change_label }} {% endif %}{% include "django/forms/widgets/input.html" %}{% if widget.value %}

    {% endif %} +{% if widget.value %}

    {{ current_label }} {{ widget.value }}
    {{ change_label }} {% endif %}{% include "django/forms/widgets/input.html" %}{% if widget.value %}

    {% endif %} diff --git a/django/contrib/admin/templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html index a48017700fc..8c26108c6e2 100644 --- a/django/contrib/admin/templates/registration/password_change_form.html +++ b/django/contrib/admin/templates/registration/password_change_form.html @@ -1,6 +1,6 @@ {% extends "admin/base_site.html" %} {% load i18n static %} -{% block extrastyle %}{{ block.super }}{% endblock %} +{% block extrastyle %}{{ block.super }}{% endblock %} {% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}{% trans 'Documentation' %} / {% endif %} {% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} {% block breadcrumbs %} diff --git a/django/contrib/admin/templates/registration/password_reset_confirm.html b/django/contrib/admin/templates/registration/password_reset_confirm.html index 1a24527c1d7..8666fa903c6 100644 --- a/django/contrib/admin/templates/registration/password_reset_confirm.html +++ b/django/contrib/admin/templates/registration/password_reset_confirm.html @@ -1,7 +1,7 @@ {% extends "admin/base_site.html" %} {% load i18n static %} -{% block extrastyle %}{{ block.super }}{% endblock %} +{% block extrastyle %}{{ block.super }}{% endblock %} {% block breadcrumbs %} - + diff --git a/django/contrib/admin/templates/registration/password_reset_form.html b/django/contrib/admin/templates/registration/password_reset_form.html index 5110d1a9951..5c5d761d978 100644 --- a/django/contrib/admin/templates/registration/password_reset_form.html +++ b/django/contrib/admin/templates/registration/password_reset_form.html @@ -1,7 +1,7 @@ {% extends "admin/base_site.html" %} {% load i18n static %} -{% block extrastyle %}{{ block.super }}{% endblock %} +{% block extrastyle %}{{ block.super }}{% endblock %} {% block breadcrumbs %} - + diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 7908b0333fb..ab0db803010 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -177,7 +177,7 @@ def result_headers(cl): def _boolean_icon(field_val): icon_url = static('admin/img/icon-%s.svg' % {True: 'yes', False: 'no', None: 'unknown'}[field_val]) - return format_html('{}', icon_url, field_val) + return format_html('{}', icon_url, field_val) def _coerce_field_name(field_name, field_index): diff --git a/django/contrib/admindocs/templates/admin_doc/template_filter_index.html b/django/contrib/admindocs/templates/admin_doc/template_filter_index.html index 44f0c71aae2..caf983ac6de 100644 --- a/django/contrib/admindocs/templates/admin_doc/template_filter_index.html +++ b/django/contrib/admindocs/templates/admin_doc/template_filter_index.html @@ -20,12 +20,12 @@ {% for library in filter_libraries %}

    {% firstof library.grouper _("Built-in filters") %}

    - {% if library.grouper %}

    {% blocktrans with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these filters, put {{ code }} in your template before using the filter.{% endblocktrans %}


    {% endif %} + {% if library.grouper %}

    {% blocktrans with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these filters, put {{ code }} in your template before using the filter.{% endblocktrans %}


    {% endif %} {% for filter in library.list|dictsort:"name" %}

    {{ filter.name }}

    {{ filter.title }} {{ filter.body }} - {% if not forloop.last %}
    {% endif %} + {% if not forloop.last %}
    {% endif %} {% endfor %}
    {% endfor %} diff --git a/django/contrib/admindocs/templates/admin_doc/template_tag_index.html b/django/contrib/admindocs/templates/admin_doc/template_tag_index.html index 61969854742..bb4f2391475 100644 --- a/django/contrib/admindocs/templates/admin_doc/template_tag_index.html +++ b/django/contrib/admindocs/templates/admin_doc/template_tag_index.html @@ -20,12 +20,12 @@ {% for library in tag_libraries %}

    {% firstof library.grouper _("Built-in tags") %}

    - {% if library.grouper %}

    {% blocktrans with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these tags, put {{ code }} in your template before using the tag.{% endblocktrans %}


    {% endif %} + {% if library.grouper %}

    {% blocktrans with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these tags, put {{ code }} in your template before using the tag.{% endblocktrans %}


    {% endif %} {% for tag in library.list|dictsort:"name" %}

    {{ tag.name }}

    {{ tag.title|striptags }}

    {{ tag.body }} - {% if not forloop.last %}
    {% endif %} + {% if not forloop.last %}
    {% endif %} {% endfor %}
    {% endfor %} diff --git a/django/contrib/admindocs/templates/admin_doc/view_index.html b/django/contrib/admindocs/templates/admin_doc/view_index.html index 16e48ca8dcb..77b3e40b1dc 100644 --- a/django/contrib/admindocs/templates/admin_doc/view_index.html +++ b/django/contrib/admindocs/templates/admin_doc/view_index.html @@ -50,7 +50,7 @@ View function: {{ full_name }}. Name: {{ url_name }}. {% endblocktrans %}

    {{ view.title }}

    -
    +
    {% endifchanged %} {% endfor %} diff --git a/django/forms/forms.py b/django/forms/forms.py index 1be78149935..19d5778468a 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -274,7 +274,7 @@ class BaseForm: normal_row='%(label)s%(errors)s%(field)s%(help_text)s', error_row='%s', row_ender='', - help_text_html='
    %s', + help_text_html='
    %s', errors_on_separate_row=False) def as_ul(self): diff --git a/django/forms/jinja2/django/forms/widgets/clearable_file_input.html b/django/forms/jinja2/django/forms/widgets/clearable_file_input.html index 7248f32d2a6..9e76435216a 100644 --- a/django/forms/jinja2/django/forms/widgets/clearable_file_input.html +++ b/django/forms/jinja2/django/forms/widgets/clearable_file_input.html @@ -1,5 +1,5 @@ {% if widget.is_initial %}{{ widget.initial_text }}: {{ widget.value }}{% if not widget.required %} - -{% endif %}
    + +{% endif %}
    {{ widget.input_text }}:{% endif %} - + diff --git a/django/forms/jinja2/django/forms/widgets/input.html b/django/forms/jinja2/django/forms/widgets/input.html index abbdf6bd26d..d5651571f22 100644 --- a/django/forms/jinja2/django/forms/widgets/input.html +++ b/django/forms/jinja2/django/forms/widgets/input.html @@ -1 +1 @@ - + diff --git a/django/forms/templates/django/forms/widgets/clearable_file_input.html b/django/forms/templates/django/forms/widgets/clearable_file_input.html index 7248f32d2a6..9e76435216a 100644 --- a/django/forms/templates/django/forms/widgets/clearable_file_input.html +++ b/django/forms/templates/django/forms/widgets/clearable_file_input.html @@ -1,5 +1,5 @@ {% if widget.is_initial %}{{ widget.initial_text }}: {{ widget.value }}{% if not widget.required %} - -{% endif %}
    + +{% endif %}
    {{ widget.input_text }}:{% endif %} - + diff --git a/django/forms/templates/django/forms/widgets/input.html b/django/forms/templates/django/forms/widgets/input.html index 5feef43c553..9010a921450 100644 --- a/django/forms/templates/django/forms/widgets/input.html +++ b/django/forms/templates/django/forms/widgets/input.html @@ -1 +1 @@ - + diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 6ccbb862744..76c12e2dcb6 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -74,7 +74,7 @@ class Media: media = sorted(self._css) return chain.from_iterable([ format_html( - '', + '', self.absolute_path(path), medium ) for path in self._css[medium] ] for medium in media) diff --git a/django/template/backends/utils.py b/django/template/backends/utils.py index 8147bb49889..8d41213965a 100644 --- a/django/template/backends/utils.py +++ b/django/template/backends/utils.py @@ -6,7 +6,7 @@ from django.utils.safestring import SafeText def csrf_input(request): return format_html( - '', + '', get_token(request)) diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index 5d7665d64e9..e876c555f3b 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -404,7 +404,7 @@ def force_escape(value): def linebreaks_filter(value, autoescape=True): """ Replace line breaks in plain text with appropriate HTML; a single - newline becomes an HTML line break (``
    ``) and a new line + newline becomes an HTML line break (``
    ``) and a new line followed by a blank line becomes a paragraph break (``

    ``). """ autoescape = autoescape and not isinstance(value, SafeData) @@ -416,13 +416,13 @@ def linebreaks_filter(value, autoescape=True): def linebreaksbr(value, autoescape=True): """ Convert all newlines in a piece of plain text to HTML line breaks - (``
    ``). + (``
    ``). """ autoescape = autoescape and not isinstance(value, SafeData) value = normalize_newlines(value) if autoescape: value = escape(value) - return mark_safe(value.replace('\n', '
    ')) + return mark_safe(value.replace('\n', '
    ')) @register.filter(is_safe=True) diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 6d8813b2fe7..abb72fa13c9 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -54,7 +54,7 @@ class CsrfTokenNode(Node): if csrf_token == 'NOTPROVIDED': return format_html("") else: - return format_html("", csrf_token) + return format_html("", csrf_token) else: # It's very probable that the token is missing because of # misconfiguration, so we raise a warning @@ -1408,7 +1408,7 @@ def widthratio(parser, token): For example:: Bar + height="10" width="{% widthratio this_value max_value max_width %}"> If ``this_value`` is 175, ``max_value`` is 200, and ``max_width`` is 100, the image in the above example will be 88 pixels wide diff --git a/django/test/html.py b/django/test/html.py index fdedafe76e4..c01f73c1fba 100644 --- a/django/test/html.py +++ b/django/test/html.py @@ -118,7 +118,7 @@ class Element: output += ''.join(str(c) for c in self.children) output += '\n' % self.name else: - output += ' />' + output += '>' return output def __repr__(self): diff --git a/django/utils/html.py b/django/utils/html.py index 9c219ba1c6d..e6389d4db56 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -124,13 +124,13 @@ def format_html_join(sep, format_string, args_generator): @keep_lazy_text def linebreaks(value, autoescape=False): - """Convert newlines into

    and
    s.""" + """Convert newlines into

    and
    s.""" value = normalize_newlines(value) paras = re.split('\n{2,}', str(value)) if autoescape: - paras = ['

    %s

    ' % escape(p).replace('\n', '
    ') for p in paras] + paras = ['

    %s

    ' % escape(p).replace('\n', '
    ') for p in paras] else: - paras = ['

    %s

    ' % p.replace('\n', '
    ') for p in paras] + paras = ['

    %s

    ' % p.replace('\n', '
    ') for p in paras] return '\n\n'.join(paras) diff --git a/django/views/static.py b/django/views/static.py index c9d4b0317a7..c93c136993b 100644 --- a/django/views/static.py +++ b/django/views/static.py @@ -62,9 +62,9 @@ DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ - - - + + + {% blocktrans %}Index of {{ directory }}{% endblocktrans %} diff --git a/docs/howto/static-files/index.txt b/docs/howto/static-files/index.txt index 847e3c9c195..bff1a5daa11 100644 --- a/docs/howto/static-files/index.txt +++ b/docs/howto/static-files/index.txt @@ -30,7 +30,7 @@ Configuring static files .. code-block:: html+django {% load static %} - My image + My image 4. Store your static files in a folder called ``static`` in your app. For example ``my_app/static/my_app/example.jpg``. diff --git a/docs/intro/contributing.txt b/docs/intro/contributing.txt index 07d9aae379b..ef44c816007 100644 --- a/docs/intro/contributing.txt +++ b/docs/intro/contributing.txt @@ -535,8 +535,8 @@ Use the arrow keys to move up and down. +++ b/docs/ref/forms/api.txt @@ -1065,3 +1065,13 @@ You can put several Django forms inside one ``
    `` tag. To give each >>> print(father.as_ul()) -
  • -
  • +
  • +
  • + +The prefix can also be specified on the form class:: + diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt index f6e34b06956..7cf17ba3760 100644 --- a/docs/intro/overview.txt +++ b/docs/intro/overview.txt @@ -307,7 +307,7 @@ Here's what the "base.html" template, including the use of :doc:`static files {% block title %}{% endblock %} - Logo + Logo {% block content %}{% endblock %} diff --git a/docs/intro/tutorial04.txt b/docs/intro/tutorial04.txt index 6f685fc4025..8e1f8d9aeff 100644 --- a/docs/intro/tutorial04.txt +++ b/docs/intro/tutorial04.txt @@ -22,10 +22,10 @@ tutorial, so that the template contains an HTML ```` element: {% csrf_token %} {% for choice in question.choice_set.all %} - -
    + +
    {% endfor %} - +
    A quick rundown: diff --git a/docs/intro/tutorial06.txt b/docs/intro/tutorial06.txt index 0d3dd233154..231ae315eef 100644 --- a/docs/intro/tutorial06.txt +++ b/docs/intro/tutorial06.txt @@ -70,7 +70,7 @@ Next, add the following at the top of ``polls/templates/polls/index.html``: {% load static %} - + The ``{% static %}`` template tag generates the absolute URL of static files. diff --git a/docs/ref/class-based-views/generic-editing.txt b/docs/ref/class-based-views/generic-editing.txt index 65cd7725367..8c1fe0f7587 100644 --- a/docs/ref/class-based-views/generic-editing.txt +++ b/docs/ref/class-based-views/generic-editing.txt @@ -76,7 +76,7 @@ editing content:
    {% csrf_token %} {{ form.as_p }} - +
    @@ -132,7 +132,7 @@ editing content:
    {% csrf_token %} {{ form.as_p }} - +
    ``UpdateView`` @@ -189,7 +189,7 @@ editing content:
    {% csrf_token %} {{ form.as_p }} - +
    ``DeleteView`` @@ -240,5 +240,5 @@ editing content:
    {% csrf_token %}

    Are you sure you want to delete "{{ object }}"?

    - +
    diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index c043561f171..39c02f26afd 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1180,7 +1180,7 @@ subclass:: # for each line of the address and you want to separate each # line by a linebreak return format_html_join( - mark_safe('
    '), + mark_safe('
    '), '{}', ((line,) for line in instance.get_full_address()), ) or mark_safe("I can't determine this address.") diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 5e001a2f62e..bafa688f984 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -255,9 +255,9 @@ precedence:: ... comment = forms.CharField() >>> f = CommentForm(initial={'name': 'instance'}, auto_id=False) >>> print(f) - Name: - Url: - Comment: + Name: + Url: + Comment: .. method:: Form.get_initial_for_field(field, field_name) @@ -322,10 +322,10 @@ You can alter the field of :class:`Form` instance to change the way it is presented in the form:: >>> f.as_table().split('\n')[0] - 'Name:' + 'Name:' >>> f.fields['name'].label = "Username" >>> f.as_table().split('\n')[0] - 'Username:' + 'Username:' Beware not to alter the ``base_fields`` attribute because this modification will influence all subsequent ``ContactForm`` instances within the same Python @@ -334,7 +334,7 @@ process:: >>> f.base_fields['name'].label = "Username" >>> another_f = CommentForm(auto_id=False) >>> another_f.as_table().split('\n')[0] - 'Username:' + 'Username:' Accessing "clean" data ====================== @@ -438,10 +438,10 @@ simply ``print`` it:: >>> f = ContactForm() >>> print(f) - - - - + + + + If the form is bound to data, the HTML output will include that data appropriately. For example, if a field is represented by an @@ -455,10 +455,10 @@ include ``checked`` if appropriate:: ... 'cc_myself': True} >>> f = ContactForm(data) >>> print(f) - - - - + + + + This default output is a two-column HTML table, with a ```` for each field. Notice the following: @@ -506,12 +506,12 @@ containing one field:: >>> f = ContactForm() >>> f.as_p() - '

    \n

    \n

    \n

    ' + '

    \n

    \n

    \n

    ' >>> print(f.as_p()) -

    -

    -

    -

    +

    +

    +

    +

    ``as_ul()`` ----------- @@ -525,12 +525,12 @@ flexibility:: >>> f = ContactForm() >>> f.as_ul() - '
  • \n
  • \n
  • \n
  • ' + '
  • \n
  • \n
  • \n
  • ' >>> print(f.as_ul()) -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
  • ``as_table()`` -------------- @@ -543,12 +543,12 @@ it calls its ``as_table()`` method behind the scenes:: >>> f = ContactForm() >>> f.as_table() - '\n\n\n' + '\n\n\n' >>> print(f) - - - - + + + + .. _ref-forms-api-styling-form-rows: @@ -618,20 +618,20 @@ tags nor ``id`` attributes:: >>> f = ContactForm(auto_id=False) >>> print(f.as_table()) - Subject: - Message: - Sender: - Cc myself: + Subject: + Message: + Sender: + Cc myself: >>> print(f.as_ul()) -
  • Subject:
  • -
  • Message:
  • -
  • Sender:
  • -
  • Cc myself:
  • +
  • Subject:
  • +
  • Message:
  • +
  • Sender:
  • +
  • Cc myself:
  • >>> print(f.as_p()) -

    Subject:

    -

    Message:

    -

    Sender:

    -

    Cc myself:

    +

    Subject:

    +

    Message:

    +

    Sender:

    +

    Cc myself:

    If ``auto_id`` is set to ``True``, then the form output *will* include ``