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 %}
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 %}
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 @@
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 %} {% endif %}
+ {% if field.help_text %} {% 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 @@
-
+
{% endif %}
{% if can_add_related %}
-
+
{% endif %}
{% if can_delete_related %}
-
+
{% 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 %}
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 %}
-
-{{ widget.clear_checkbox_label }} {% endif %}
+
+{{ widget.clear_checkbox_label }} {% 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 @@
-
+
{% endif %}
{% if can_add_related %}
-
+
{% endif %}
{% if can_delete_related %}
-
+
{% 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 %}
{% trans 'Home' %}
@@ -29,7 +29,7 @@
{% trans 'Confirm password:' %}
{{ form.new_password2 }}
-
+
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 %}
-
-{{ widget.clear_checkbox_label }} {% endif %}
+
+{{ widget.clear_checkbox_label }} {% 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 %}
-
-{{ widget.clear_checkbox_label }} {% endif %}
+
+{{ widget.clear_checkbox_label }} {% 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::
+ 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%s>' % 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 %}
-
+
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 ``
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:
@@ -132,7 +132,7 @@ editing content:
``UpdateView``
@@ -189,7 +189,7 @@ editing content:
``DeleteView``
@@ -240,5 +240,5 @@ editing content:
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)
- Subject:
- Message:
- Sender:
- Cc myself:
+ Subject:
+ Message:
+ Sender:
+ Cc myself:
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)
- Subject:
- Message:
- Sender:
- Cc myself:
+ Subject:
+ Message:
+ Sender:
+ Cc myself:
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()
- 'Subject:
\nMessage:
\nSender:
\nCc myself:
'
+ 'Subject:
\nMessage:
\nSender:
\nCc myself:
'
>>> print(f.as_p())
- Subject:
- Message:
- Sender:
- Cc myself:
+ Subject:
+ Message:
+ Sender:
+ Cc myself:
``as_ul()``
-----------
@@ -525,12 +525,12 @@ flexibility::
>>> f = ContactForm()
>>> f.as_ul()
- 'Subject: \nMessage: \nSender: \nCc myself: '
+ 'Subject: \nMessage: \nSender: \nCc myself: '
>>> print(f.as_ul())
- Subject:
- Message:
- Sender:
- Cc myself:
+ Subject:
+ Message:
+ Sender:
+ Cc myself:
``as_table()``
--------------
@@ -543,12 +543,12 @@ it calls its ``as_table()`` method behind the scenes::
>>> f = ContactForm()
>>> f.as_table()
- ' Subject: \nMessage: \nSender: \nCc myself: '
+ 'Subject: \nMessage: \nSender: \nCc myself: '
>>> print(f)
- Subject:
- Message:
- Sender:
- Cc myself:
+ Subject:
+ Message:
+ Sender:
+ Cc myself:
.. _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
```` tags and will simply use the field name as its ``id`` for each form
@@ -639,20 +639,20 @@ field::
>>> f = ContactForm(auto_id=True)
>>> 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 a string containing the format character ``'%s'``,
then the form output will include ```` tags, and will generate ``id``
@@ -662,20 +662,20 @@ attributes based on the format string. For example, for a format string
>>> f = ContactForm(auto_id='id_for_%s')
>>> 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 any other true value -- such as a string that doesn't
include ``%s`` -- then the library will act as if ``auto_id`` is ``True``.
@@ -692,16 +692,16 @@ It's possible to customize that character, or omit it entirely, using the
>>> f = ContactForm(auto_id='id_for_%s', label_suffix='')
>>> print(f.as_ul())
- Subject
- Message
- Sender
- Cc myself
+ Subject
+ Message
+ Sender
+ Cc myself
>>> f = ContactForm(auto_id='id_for_%s', label_suffix=' ->')
>>> print(f.as_ul())
- Subject ->
- Message ->
- Sender ->
- Cc myself ->
+ Subject ->
+ Message ->
+ Sender ->
+ Cc myself ->
Note that the label suffix is added only if the last character of the
label isn't a punctuation character (in English, those are ``.``, ``!``, ``?``
@@ -788,22 +788,22 @@ method you're using::
... 'cc_myself': True}
>>> f = ContactForm(data, auto_id=False)
>>> print(f.as_table())
- Subject:
- Message:
- Sender: Enter a valid email address.
- Cc myself:
+ Subject:
+ Message:
+ Sender: Enter a valid email address.
+ Cc myself:
>>> print(f.as_ul())
- Subject:
- Message:
- Enter a valid email address. Sender:
- Cc myself:
+ Subject:
+ Message:
+ Enter a valid email address. Sender:
+ Cc myself:
>>> print(f.as_p())
- Subject:
- Message:
+ Subject:
+ Message:
Enter a valid email address.
- Sender:
- Cc myself:
+ Sender:
+ Cc myself:
.. _ref-forms-error-list-format:
@@ -824,11 +824,11 @@ pass that in at construction time::
>>> f = ContactForm(data, auto_id=False, error_class=DivErrorList)
>>> f.as_p()
- Subject:
- Message:
+ Subject:
+ Message:
Enter a valid email address.
- Sender:
- Cc myself:
+ Sender:
+ Cc myself:
More granular output
====================
@@ -848,25 +848,25 @@ using the field's name as the key::
>>> form = ContactForm()
>>> print(form['subject'])
-
+
To retrieve all ``BoundField`` objects, iterate the form::
>>> form = ContactForm()
>>> for boundfield in form: print(boundfield)
-
-
-
-
+
+
+
+
The field-specific output honors the form object's ``auto_id`` setting::
>>> f = ContactForm(auto_id=False)
>>> print(f['message'])
-
+
>>> f = ContactForm(auto_id='id_%s')
>>> print(f['message'])
-
+
Attributes of ``BoundField``
----------------------------
@@ -897,7 +897,7 @@ Attributes of ``BoundField``
>>> data = {'subject': 'hi', 'message': '', 'sender': '', 'cc_myself': ''}
>>> f = ContactForm(data, auto_id=False)
>>> print(f['message'])
-
+
>>> f['message'].errors
['This field is required.']
>>> print(f['message'].errors)
@@ -949,7 +949,7 @@ Attributes of ``BoundField``
.. code-block:: html
- ...
+ ...
.. attribute:: BoundField.is_hidden
@@ -1168,11 +1168,11 @@ fields are ordered first::
... priority = forms.CharField()
>>> f = ContactFormWithPriority(auto_id=False)
>>> print(f.as_ul())
- Subject:
- Message:
- Sender:
- Cc myself:
- Priority:
+ Subject:
+ Message:
+ Sender:
+ Cc myself:
+ Priority:
It's possible to subclass multiple forms, treating forms as mixins. In this
example, ``BeatleForm`` subclasses both ``PersonForm`` and ``InstrumentForm``
@@ -1189,10 +1189,10 @@ classes::
... haircut_type = forms.CharField()
>>> b = BeatleForm(auto_id=False)
>>> print(b.as_ul())
- First name:
- Last name:
- Instrument:
- Haircut type:
+ First name:
+ Last name:
+ Instrument:
+ Haircut type:
It's possible to declaratively remove a ``Field`` inherited from a parent class
by setting the name of the field to ``None`` on the subclass. For example::
@@ -1222,11 +1222,11 @@ You can put several Django forms inside one ``
{# Assumes you setup the password_reset view in your URLconf #}
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt
index 08c0194e535..cb07e7ad59e 100644
--- a/docs/topics/forms/formsets.txt
+++ b/docs/topics/forms/formsets.txt
@@ -29,8 +29,8 @@ would with a regular form::
>>> formset = ArticleFormSet()
>>> for form in formset:
... print(form.as_table())
- Title:
- Pub date:
+ Title:
+ Pub date:
As you can see it only displayed one empty form. The number of empty forms
that is displayed is controlled by the ``extra`` parameter. By default,
@@ -69,12 +69,12 @@ example::
>>> for form in formset:
... print(form.as_table())
- Title:
- Pub date:
- Title:
- Pub date:
- Title:
- Pub date:
+ Title:
+ Pub date:
+ Title:
+ Pub date:
+ Title:
+ Pub date:
There are now a total of three forms showing above. One for the initial data
that was passed in and two extra forms. Also note that we are passing in a
@@ -103,8 +103,8 @@ gives you the ability to limit the number of forms the formset will display::
>>> formset = ArticleFormSet()
>>> for form in formset:
... print(form.as_table())
- Title:
- Pub date:
+ Title:
+ Pub date:
If the value of ``max_num`` is greater than the number of existing items in the
initial data, up to ``extra`` additional blank forms will be added to the
@@ -406,15 +406,15 @@ Lets you create a formset with the ability to order::
... ])
>>> for form in formset:
... print(form.as_table())
- Title:
- Pub date:
- Order:
- Title:
- Pub date:
- Order:
- Title:
- Pub date:
- Order:
+ Title:
+ Pub date:
+ Order:
+ Title:
+ Pub date:
+ Order:
+ Title:
+ Pub date:
+ Order:
This adds an additional field to each form. This new field is named ``ORDER``
and is an ``forms.IntegerField``. For the forms that came from the initial
@@ -466,15 +466,15 @@ Lets you create a formset with the ability to select forms for deletion::
... ])
>>> for form in formset:
... print(form.as_table())
- Title:
- Pub date:
- Delete:
- Title:
- Pub date:
- Delete:
- Title:
- Pub date:
- Delete:
+ Title:
+ Pub date:
+ Delete:
+ Title:
+ Pub date:
+ Delete:
+ Title:
+ Pub date:
+ Delete:
Similar to ``can_order`` this adds a new field to each form named ``DELETE``
and is a ``forms.BooleanField``. When data comes through marking any of the
@@ -540,9 +540,9 @@ default fields/attributes of the order and deletion fields::
>>> formset = ArticleFormSet()
>>> for form in formset:
... print(form.as_table())
- Title:
- Pub date:
- My field:
+ Title:
+ Pub date:
+ My field:
.. _custom-formset-form-kwargs:
@@ -592,14 +592,14 @@ For example, in the default case, you might see:
.. code-block:: html
Title:
-
+
But with ``ArticleFormset(prefix='article')`` that becomes:
.. code-block:: html
Title:
-
+
This is useful if you want to :ref:`use more than one formset in a view
`.
diff --git a/docs/topics/forms/index.txt b/docs/topics/forms/index.txt
index 86de7d1b06a..71d5a37ed9e 100644
--- a/docs/topics/forms/index.txt
+++ b/docs/topics/forms/index.txt
@@ -259,7 +259,7 @@ The whole form, when rendered for the first time, will look like:
.. code-block:: html+django
Your name:
-
+
Note that it **does not** include the ``
All the form's fields and their attributes will be unpacked into HTML markup
@@ -512,13 +512,13 @@ Here's the output of ``{{ form.as_p }}`` for our ``ContactForm`` instance:
.. code-block:: html+django
Subject:
-
+
Message:
Sender:
-
+
Cc myself:
-
+
Note that each form field has an ID attribute set to ``id_``, which
is referenced by the accompanying label tag. This is important in ensuring that
diff --git a/docs/topics/forms/media.txt b/docs/topics/forms/media.txt
index 28c5054bc3b..6b9165339f5 100644
--- a/docs/topics/forms/media.txt
+++ b/docs/topics/forms/media.txt
@@ -71,7 +71,7 @@ can be retrieved through this property::
>>> w = CalendarWidget()
>>> print(w.media)
-
+
@@ -114,9 +114,9 @@ requirements::
If this last CSS definition were to be rendered, it would become the following HTML::
-
-
-
+
+
+
``js``
------
@@ -145,8 +145,8 @@ example above::
>>> w = FancyCalendarWidget()
>>> print(w.media)
-
-
+
+
@@ -165,7 +165,7 @@ an ``extend=False`` declaration to the ``Media`` declaration::
>>> w = FancyCalendarWidget()
>>> print(w.media)
-
+
If you require even more control over inheritance, define your assets using a
@@ -228,7 +228,7 @@ was ``None``::
>>> w = CalendarWidget()
>>> print(w.media)
-
+
@@ -236,7 +236,7 @@ But if :setting:`STATIC_URL` is ``'http://static.example.com/'``::
>>> w = CalendarWidget()
>>> print(w.media)
-
+
@@ -245,7 +245,7 @@ Or if :mod:`~django.contrib.staticfiles` is configured using the
>>> w = CalendarWidget()
>>> print(w.media)
-
+
@@ -268,12 +268,12 @@ operator to filter out a medium of interest. For example::
>>> w = CalendarWidget()
>>> print(w.media)
-
+
>>> print(w.media['css'])
-
+
When you use the subscript operator, the value that is returned is a
new ``Media`` object -- but one that only contains the media of interest.
@@ -300,7 +300,7 @@ specified by both::
>>> w1 = CalendarWidget()
>>> w2 = OtherWidget()
>>> print(w1.media + w2.media)
-
+
@@ -362,7 +362,7 @@ are part of the form::
>>> f = ContactForm()
>>> f.media
-
+
@@ -382,8 +382,8 @@ form::
>>> f = ContactForm()
>>> f.media
-
-
+
+
diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt
index 3c49e3b8e3c..553271e5981 100644
--- a/docs/topics/forms/modelforms.txt
+++ b/docs/topics/forms/modelforms.txt
@@ -770,14 +770,14 @@ with the ``Author`` model. It works just like a regular formset::
>>> formset = AuthorFormSet()
>>> print(formset)
-
- Name:
+
+ Name:
Title:
---------
Mr.
Mrs.
Ms.
-
+
.. note::
@@ -959,10 +959,10 @@ so long as the total number of forms does not exceed ``max_num``::
>>> formset = AuthorFormSet(queryset=Author.objects.order_by('name'))
>>> for form in formset:
... print(form.as_table())
- Name:
- Name:
- Name:
- Name:
+ Name:
+ Name:
+ Name:
+ Name:
A ``max_num`` value of ``None`` (the default) puts a high limit on the number
of forms displayed (1000). In practice this is equivalent to no limit.
diff --git a/docs/topics/i18n/timezones.txt b/docs/topics/i18n/timezones.txt
index 902dd7aa3a1..eb976777778 100644
--- a/docs/topics/i18n/timezones.txt
+++ b/docs/topics/i18n/timezones.txt
@@ -204,7 +204,7 @@ Include a form in ``template.html`` that will ``POST`` to this view:
{{ tz }}
{% endfor %}
-
+
.. _time-zones-in-forms:
diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt
index 305f3a58390..5003bfb9978 100644
--- a/docs/topics/i18n/translation.txt
+++ b/docs/topics/i18n/translation.txt
@@ -610,7 +610,7 @@ filters::
{% for stage in tour_stages %}
- {% cycle start end %}: {{ stage }}{% if forloop.counter|divisibleby:2 %} {% else %}, {% endif %}
+ {% cycle start end %}: {{ stage }}{% if forloop.counter|divisibleby:2 %} {% else %}, {% endif %}
{% endfor %}
@@ -891,9 +891,9 @@ use the ``{% get_language_info %}`` tag::
You can then access the information::
- Language code: {{ lang.code }}
- Name of language: {{ lang.name_local }}
- Name in English: {{ lang.name }}
+ Language code: {{ lang.code }}
+ Name of language: {{ lang.name_local }}
+ Name in English: {{ lang.name }}
Bi-directional: {{ lang.bidi }}
Name in the active language: {{ lang.name_translated }}
@@ -1788,7 +1788,7 @@ Here's example HTML template code:
{% load i18n %}
In this example, Django looks up the URL of the page to which the user will be
diff --git a/docs/topics/pagination.txt b/docs/topics/pagination.txt
index 81efaafd284..80a6b66fc68 100644
--- a/docs/topics/pagination.txt
+++ b/docs/topics/pagination.txt
@@ -101,7 +101,7 @@ pages along with any interesting information from the objects themselves::
{% for contact in contacts %}
{# Each "contact" is a Contact model object. #}
- {{ contact.full_name|upper }}
+ {{ contact.full_name|upper }}
...
{% endfor %}
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index c7ae792fb5d..d3be9e2124e 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -1485,7 +1485,7 @@ your test suite.
self.assertHTMLEqual(
'Hello world!
',
'''
- Hello world!
+ Hello world!
'''
)
self.assertHTMLEqual(
diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py
index 5f3d30fd683..5be70ee6ad8 100644
--- a/tests/admin_changelist/tests.py
+++ b/tests/admin_changelist/tests.py
@@ -39,7 +39,7 @@ def build_tbody_html(pk, href, extra_fields):
''
''
' '
+ 'class="action-select">'
'name '
'{} '
).format(pk, href, extra_fields)
@@ -209,7 +209,7 @@ class ChangeListTests(TestCase):
# make sure that hidden fields are in the correct place
hiddenfields_div = (
''
- ' '
+ ' '
'
'
) % new_child.id
self.assertInHTML(hiddenfields_div, table_output, msg_prefix='Failed to find hidden fields')
@@ -217,7 +217,7 @@ class ChangeListTests(TestCase):
# make sure that list editable fields are rendered in divs correctly
editable_name_field = (
' '
+ 'maxlength="30" type="text" id="id_form-0-name">'
)
self.assertInHTML(
'%s ' % editable_name_field,
diff --git a/tests/admin_docs/test_views.py b/tests/admin_docs/test_views.py
index a64da843ed5..be69799d70e 100644
--- a/tests/admin_docs/test_views.py
+++ b/tests/admin_docs/test_views.py
@@ -28,7 +28,7 @@ class AdminDocViewTests(TestDataMixin, AdminDocsTestCase):
self.client.logout()
response = self.client.get(reverse('django-admindocs-docroot'), follow=True)
# Should display the login screen
- self.assertContains(response, ' ', html=True)
+ self.assertContains(response, ' ', html=True)
def test_bookmarklets(self):
response = self.client.get(reverse('django-admindocs-bookmarklets'))
diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
index 67ffa7648fb..73b1bd065e1 100644
--- a/tests/admin_inlines/tests.py
+++ b/tests/admin_inlines/tests.py
@@ -161,7 +161,7 @@ class TestInline(TestDataMixin, TestCase):
' ',
+ 'title="Awesome tabular help text is awesome.">',
1
)
# ReadOnly fields
@@ -171,7 +171,7 @@ class TestInline(TestDataMixin, TestCase):
' ',
+ 'title="Help text for ReadOnlyInline">',
1
)
@@ -184,7 +184,7 @@ class TestInline(TestDataMixin, TestCase):
self.assertNotContains(response, '')
self.assertInHTML(
' ',
+ 'name="somechildmodel_set-1-position" type="hidden" value="1">',
response.rendered_content,
)
@@ -193,26 +193,26 @@ class TestInline(TestDataMixin, TestCase):
Multiple inlines with related_name='+' have correct form prefixes.
"""
response = self.client.get(reverse('admin:admin_inlines_capofamiglia_add'))
- self.assertContains(response, ' ', html=True)
+ self.assertContains(response, ' ', html=True)
self.assertContains(
response,
- ' ',
+ ' ',
html=True
)
self.assertContains(
response,
- ' ',
+ ' ',
html=True
)
- self.assertContains(response, ' ', html=True)
+ self.assertContains(response, ' ', html=True)
self.assertContains(
response,
- ' ',
+ ' ',
html=True
)
self.assertContains(
response,
- ' ',
+ ' ',
html=True
)
@@ -265,12 +265,12 @@ class TestInline(TestDataMixin, TestCase):
# ModelAdmin
max_forms_input = (
' '
+ 'name="binarytree_set-MAX_NUM_FORMS" type="hidden" value="%d">'
)
# The total number of forms will remain the same in either case
total_forms_hidden = (
' '
+ 'name="binarytree_set-TOTAL_FORMS" type="hidden" value="2">'
)
response = self.client.get(reverse('admin:admin_inlines_binarytree_add'))
self.assertInHTML(max_forms_input % 3, response.rendered_content)
@@ -293,11 +293,11 @@ class TestInline(TestDataMixin, TestCase):
modeladmin.inlines = [MinNumInline]
min_forms = (
' '
+ 'name="binarytree_set-MIN_NUM_FORMS" type="hidden" value="2">'
)
total_forms = (
' '
+ 'name="binarytree_set-TOTAL_FORMS" type="hidden" value="5">'
)
request = self.factory.get(reverse('admin:admin_inlines_binarytree_add'))
request.user = User(username='super', is_superuser=True)
@@ -322,11 +322,11 @@ class TestInline(TestDataMixin, TestCase):
modeladmin.inlines = [MinNumInline]
min_forms = (
' '
+ 'name="binarytree_set-MIN_NUM_FORMS" type="hidden" value="%d">'
)
total_forms = (
' '
+ 'name="binarytree_set-TOTAL_FORMS" type="hidden" value="%d">'
)
request = self.factory.get(reverse('admin:admin_inlines_binarytree_add'))
request.user = User(username='super', is_superuser=True)
@@ -345,13 +345,13 @@ class TestInline(TestDataMixin, TestCase):
self.assertContains(
response,
' ',
+ 'name="nonautopkbook_set-0-rand_pk" type="hidden">',
html=True
)
self.assertContains(
response,
' ',
+ 'name="nonautopkbook_set-2-0-rand_pk" type="hidden">',
html=True
)
@@ -360,13 +360,13 @@ class TestInline(TestDataMixin, TestCase):
self.assertContains(
response,
' ',
+ 'name="nonautopkbookchild_set-0-nonautopkbook_ptr" type="hidden">',
html=True
)
self.assertContains(
response,
' ',
+ 'name="nonautopkbookchild_set-2-nonautopkbook_ptr" type="hidden">',
html=True
)
@@ -375,13 +375,13 @@ class TestInline(TestDataMixin, TestCase):
self.assertContains(
response,
' ',
+ 'name="editablepkbook_set-0-manual_pk" type="number">',
html=True, count=1
)
self.assertContains(
response,
' ',
+ 'name="editablepkbook_set-2-0-manual_pk" type="number">',
html=True, count=1
)
@@ -614,7 +614,7 @@ class TestInlinePermissions(TestCase):
self.assertContains(response, 'Inner2s ')
self.assertContains(response, 'Add another Inner2')
self.assertContains(response, ' ', html=True)
+ 'value="3" name="inner2_set-TOTAL_FORMS">', html=True)
def test_inline_change_m2m_add_perm(self):
permission = Permission.objects.get(codename='add_book', content_type=self.book_ct)
@@ -634,11 +634,11 @@ class TestInlinePermissions(TestCase):
self.assertContains(response, 'Author-book relationships ')
self.assertContains(response, 'Add another Author-book relationship')
self.assertContains(response, ' ', html=True)
+ 'value="4" name="Author_books-TOTAL_FORMS">', html=True)
self.assertContains(
response,
' ' % self.author_book_auto_m2m_intermediate_id,
+ 'name="Author_books-0-id">' % self.author_book_auto_m2m_intermediate_id,
html=True
)
self.assertContains(response, 'id="id_Author_books-0-DELETE"')
@@ -654,12 +654,12 @@ class TestInlinePermissions(TestCase):
self.assertContains(
response,
' ',
+ 'name="inner2_set-TOTAL_FORMS">',
html=True
)
self.assertNotContains(
response,
- ' ' % self.inner2_id,
+ ' ' % self.inner2_id,
html=True
)
@@ -671,18 +671,18 @@ class TestInlinePermissions(TestCase):
self.assertContains(response, 'Inner2s ')
# Just the one form for existing instances
self.assertContains(
- response, ' ',
+ response, ' ',
html=True
)
self.assertContains(
response,
- ' ' % self.inner2_id,
+ ' ' % self.inner2_id,
html=True
)
# max-num 0 means we can't add new ones
self.assertContains(
response,
- ' ',
+ ' ',
html=True
)
@@ -696,12 +696,12 @@ class TestInlinePermissions(TestCase):
self.assertContains(response, 'Inner2s ')
# One form for existing instance and three extra for new
self.assertContains(
- response, ' ',
+ response, ' ',
html=True
)
self.assertContains(
response,
- ' ' % self.inner2_id,
+ ' ' % self.inner2_id,
html=True
)
@@ -716,12 +716,12 @@ class TestInlinePermissions(TestCase):
# One form for existing instance only, no new
self.assertContains(
response,
- ' ',
+ ' ',
html=True
)
self.assertContains(
response,
- ' ' % self.inner2_id,
+ ' ' % self.inner2_id,
html=True
)
self.assertContains(response, 'id="id_inner2_set-0-DELETE"')
@@ -739,12 +739,12 @@ class TestInlinePermissions(TestCase):
# One form for existing instance only, three for new
self.assertContains(
response,
- ' ',
+ ' ',
html=True
)
self.assertContains(
response,
- ' ' % self.inner2_id,
+ ' ' % self.inner2_id,
html=True
)
self.assertContains(response, 'id="id_inner2_set-0-DELETE"')
diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py
index aae8b74ae2b..4d56313ae1b 100644
--- a/tests/admin_utils/tests.py
+++ b/tests/admin_utils/tests.py
@@ -163,7 +163,7 @@ class UtilsTests(SimpleTestCase):
# Regression test for #13071: NullBooleanField has special
# handling.
display_value = display_for_field(None, models.NullBooleanField(), self.empty_value)
- expected = ' ' % settings.STATIC_URL
+ expected = ' ' % settings.STATIC_URL
self.assertHTMLEqual(display_value, expected)
display_value = display_for_field(None, models.DecimalField(), self.empty_value)
@@ -204,11 +204,11 @@ class UtilsTests(SimpleTestCase):
def test_list_display_for_value_boolean(self):
self.assertEqual(
display_for_value(True, '', boolean=True),
- ' '
+ ' '
)
self.assertEqual(
display_for_value(False, '', boolean=True),
- ' '
+ ' '
)
self.assertEqual(display_for_value(True, ''), 'True')
self.assertEqual(display_for_value(False, ''), 'False')
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index b8093c29714..a9746d9addb 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -1027,7 +1027,7 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase):
# When a site has multiple passwords in the browser's password manager,
# a browser pop up asks which user the new password is for. To prevent
# this, the username is added to the change password form.
- self.assertContains(response, ' ')
+ self.assertContains(response, ' ')
def test_extended_bodyclass_template_index(self):
"""
@@ -2969,8 +2969,8 @@ class AdminViewListEditable(TestCase):
self.assertContains(
response,
'\n'
- ' '
- ' \n
'
+ ' '
+ ' \n'
% (story2.id, story1.id),
html=True
)
@@ -2999,8 +2999,8 @@ class AdminViewListEditable(TestCase):
self.assertContains(
response,
'\n'
- ' '
- ' \n
'
+ ' '
+ ' \n'
% (story2.id, story1.id),
html=True
)
@@ -3057,7 +3057,7 @@ class AdminSearchTest(TestCase):
"""
response = self.client.get(reverse('admin:auth_user_changelist') + '?q=joe&%s=id' % TO_FIELD_VAR)
self.assertContains(response, "\n1 user\n")
- self.assertContains(response, ' ' % TO_FIELD_VAR, html=True)
+ self.assertContains(response, ' ' % TO_FIELD_VAR, html=True)
def test_exact_matches(self):
response = self.client.get(reverse('admin:admin_views_recommendation_changelist') + '?q=bar')
@@ -4388,10 +4388,10 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
self.assertContains(response, "Unknown coolness.")
self.assertContains(response, "foo")
- # Multiline text in a readonly field gets tags
- self.assertContains(response, 'Multiline test string')
- self.assertContains(response, 'Multiline html content
', html=True)
- self.assertContains(response, 'InlineMultiline test string')
+ # Multiline text in a readonly field gets tags
+ self.assertContains(response, 'Multiline test string')
+ self.assertContains(response, 'Multiline html content
', html=True)
+ self.assertContains(response, 'InlineMultiline test string')
self.assertContains(response, formats.localize(datetime.date.today() - datetime.timedelta(days=7)))
@@ -4432,9 +4432,9 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
)
response = self.client.get(reverse('admin:admin_views_post_change', args=(p.pk,)))
# Checking readonly field.
- self.assertContains(response, 'test test test test')
+ self.assertContains(response, 'test test test test')
# Checking readonly field in inline.
- self.assertContains(response, 'test link')
+ self.assertContains(response, 'test link')
def test_readonly_post(self):
data = {
@@ -5267,7 +5267,7 @@ class AdminViewLogoutTests(TestCase):
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'admin/login.html')
self.assertEqual(response.request['PATH_INFO'], reverse('admin:login'))
- self.assertContains(response, ' ' % reverse('admin:index'))
+ self.assertContains(response, ' ' % reverse('admin:index'))
@override_settings(ROOT_URLCONF='admin_views.urls')
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py
index 8c3f06670c2..c0a9e1e8441 100644
--- a/tests/admin_widgets/tests.py
+++ b/tests/admin_widgets/tests.py
@@ -274,13 +274,13 @@ class AdminDateWidgetTest(SimpleTestCase):
w = widgets.AdminDateWidget()
self.assertHTMLEqual(
w.render('test', datetime(2007, 12, 1, 9, 30)),
- ' ',
+ ' ',
)
# pass attrs to widget
w = widgets.AdminDateWidget(attrs={'size': 20, 'class': 'myDateField'})
self.assertHTMLEqual(
w.render('test', datetime(2007, 12, 1, 9, 30)),
- ' ',
+ ' ',
)
@@ -289,13 +289,13 @@ class AdminTimeWidgetTest(SimpleTestCase):
w = widgets.AdminTimeWidget()
self.assertHTMLEqual(
w.render('test', datetime(2007, 12, 1, 9, 30)),
- ' ',
+ ' ',
)
# pass attrs to widget
w = widgets.AdminTimeWidget(attrs={'size': 20, 'class': 'myTimeField'})
self.assertHTMLEqual(
w.render('test', datetime(2007, 12, 1, 9, 30)),
- ' ',
+ ' ',
)
@@ -306,9 +306,9 @@ class AdminSplitDateTimeWidgetTest(SimpleTestCase):
w.render('test', datetime(2007, 12, 1, 9, 30)),
''
'Date: '
+ 'name="test_0" size="10"> '
'Time:
'
+ 'name="test_1" size="8">'
)
def test_localization(self):
@@ -320,9 +320,9 @@ class AdminSplitDateTimeWidgetTest(SimpleTestCase):
w.render('test', datetime(2007, 12, 1, 9, 30)),
''
'Datum: '
+ 'class="vDateField" name="test_0"size="10"> '
'Zeit:
'
+ 'name="test_1" size="8">'
)
@@ -331,14 +331,14 @@ class AdminURLWidgetTest(SimpleTestCase):
w = widgets.AdminURLFieldWidget()
self.assertHTMLEqual(
w.render('test', ''),
- ' '
+ ' '
)
self.assertHTMLEqual(
w.render('test', 'http://example.com'),
'Currently:'
- 'http://example.com '
+ 'http://example.com '
'Change:
'
+ 'value="http://example.com">'
)
def test_render_idn(self):
@@ -346,9 +346,9 @@ class AdminURLWidgetTest(SimpleTestCase):
self.assertHTMLEqual(
w.render('test', 'http://example-äüö.com'),
'Currently: '
- 'http://example-äüö.com '
+ 'http://example-äüö.com '
'Change:
'
+ 'value="http://example-äüö.com">'
)
def test_render_quoting(self):
@@ -420,15 +420,15 @@ class AdminFileWidgetTests(TestDataMixin, TestCase):
'Currently: albums\hybrid_theory.jpg '
''
- ' '
- 'Clear '
- 'Change:
' % {
+ ' '
+ 'Clear '
+ 'Change: ' % {
'STORAGE_URL': default_storage.url(''),
},
)
self.assertHTMLEqual(
w.render('test', SimpleUploadedFile('test', b'content')),
- ' ',
+ ' ',
)
def test_render_required(self):
@@ -437,8 +437,8 @@ class AdminFileWidgetTests(TestDataMixin, TestCase):
self.assertHTMLEqual(
widget.render('test', self.album.cover_art),
'Currently: albums\hybrid_theory.jpg '
- 'Change:
' % {
+ r'hybrid_theory.jpg">albums\hybrid_theory.jpg '
+ 'Change: ' % {
'STORAGE_URL': default_storage.url(''),
},
)
@@ -457,7 +457,7 @@ class AdminFileWidgetTests(TestDataMixin, TestCase):
)
self.assertNotContains(
response,
- ' ',
+ ' ',
html=True,
)
response = self.client.get(reverse('admin:admin_widgets_album_add'))
@@ -482,7 +482,7 @@ class ForeignKeyRawIdWidgetTest(TestCase):
self.assertHTMLEqual(
w.render('test', band.pk, attrs={}),
' '
+ 'class="vForeignKeyRawIdAdminField">'
' '
'Linkin Park '
@@ -502,7 +502,7 @@ class ForeignKeyRawIdWidgetTest(TestCase):
self.assertHTMLEqual(
w.render('test', core.parent_id, attrs={}),
' '
+ 'class="vForeignKeyRawIdAdminField">'
' '
' '
@@ -519,7 +519,7 @@ class ForeignKeyRawIdWidgetTest(TestCase):
w = widgets.ForeignKeyRawIdWidget(rel, widget_admin_site)
self.assertHTMLEqual(
w.render('honeycomb_widget', big_honeycomb.pk, attrs={}),
- ' '
+ ' '
' %(hcomb)s '
% {'hcombpk': big_honeycomb.pk, 'hcomb': big_honeycomb}
)
@@ -534,7 +534,7 @@ class ForeignKeyRawIdWidgetTest(TestCase):
w = widgets.ForeignKeyRawIdWidget(rel, widget_admin_site)
self.assertHTMLEqual(
w.render('individual_widget', subject1.pk, attrs={}),
- ' '
+ ' '
' %(subj1)s '
% {'subj1pk': subject1.pk, 'subj1': subject1}
)
@@ -552,7 +552,7 @@ class ForeignKeyRawIdWidgetTest(TestCase):
)
self.assertHTMLEqual(
w.render('test', child_of_hidden.parent_id, attrs={}),
- ' '
+ ' '
' '
' '
@@ -574,7 +574,7 @@ class ManyToManyRawIdWidgetTest(TestCase):
w = widgets.ManyToManyRawIdWidget(rel, widget_admin_site)
self.assertHTMLEqual(
w.render('test', [m1.pk, m2.pk], attrs={}), (
- ' '
+ ' '
' '
) % {'m1pk': m1.pk, 'm2pk': m2.pk}
)
@@ -599,12 +599,12 @@ class ManyToManyRawIdWidgetTest(TestCase):
w = widgets.ManyToManyRawIdWidget(rel, widget_admin_site)
self.assertHTMLEqual(
w.render('company_widget1', [c1.pk, c2.pk], attrs={}),
- ' ' % {'c1pk': c1.pk, 'c2pk': c2.pk}
+ ' ' % {'c1pk': c1.pk, 'c2pk': c2.pk}
)
self.assertHTMLEqual(
w.render('company_widget2', [c1.pk]),
- ' ' % {'c1pk': c1.pk}
+ ' ' % {'c1pk': c1.pk}
)
diff --git a/tests/csrf_tests/views.py b/tests/csrf_tests/views.py
index 720de610e01..89d1189e0d3 100644
--- a/tests/csrf_tests/views.py
+++ b/tests/csrf_tests/views.py
@@ -8,7 +8,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie
def post_form_view(request):
"""Return a POST form (without a token)."""
return HttpResponse(content="""
-\u00a1Unicode!
+\u00a1Unicode!
""", mimetype='text/html')
diff --git a/tests/forms_tests/field_tests/test_charfield.py b/tests/forms_tests/field_tests/test_charfield.py
index ad91070571c..cbacf4d0d71 100644
--- a/tests/forms_tests/field_tests/test_charfield.py
+++ b/tests/forms_tests/field_tests/test_charfield.py
@@ -145,7 +145,7 @@ class CharFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_charfield_disabled(self):
f = CharField(disabled=True)
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
def test_null_characters_prohibited(self):
f = CharField()
diff --git a/tests/forms_tests/field_tests/test_datefield.py b/tests/forms_tests/field_tests/test_datefield.py
index a8002d463c8..bcc7db193a0 100644
--- a/tests/forms_tests/field_tests/test_datefield.py
+++ b/tests/forms_tests/field_tests/test_datefield.py
@@ -22,7 +22,7 @@ class DateFieldTest(SimpleTestCase):
# accept the input from the "as_hidden" rendering as well.
self.assertHTMLEqual(
a['mydate'].as_hidden(),
- ' ',
+ ' ',
)
b = GetDate({'mydate': '2008-4-1'})
diff --git a/tests/forms_tests/field_tests/test_decimalfield.py b/tests/forms_tests/field_tests/test_decimalfield.py
index 4e1828d53d7..44ebebcf751 100644
--- a/tests/forms_tests/field_tests/test_decimalfield.py
+++ b/tests/forms_tests/field_tests/test_decimalfield.py
@@ -11,7 +11,7 @@ class DecimalFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_decimalfield_1(self):
f = DecimalField(max_digits=4, decimal_places=2)
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
f.clean('')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
@@ -78,7 +78,7 @@ class DecimalFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
)
self.assertWidgetRendersTo(
f,
- ' ',
+ ' ',
)
with self.assertRaisesMessage(ValidationError, "'Ensure this value is less than or equal to 1.5.'"):
f.clean('1.6')
@@ -136,7 +136,7 @@ class DecimalFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
f = DecimalField(max_digits=20)
self.assertEqual(f.widget_attrs(NumberInput()), {'step': 'any'})
f = DecimalField(max_digits=6, widget=NumberInput(attrs={'step': '0.01'}))
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
def test_decimalfield_localized(self):
"""
@@ -144,7 +144,7 @@ class DecimalFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
number input specific attributes.
"""
f = DecimalField(localize=True)
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
def test_decimalfield_changed(self):
f = DecimalField(max_digits=2, decimal_places=2)
diff --git a/tests/forms_tests/field_tests/test_emailfield.py b/tests/forms_tests/field_tests/test_emailfield.py
index 15481689b0e..826524ae629 100644
--- a/tests/forms_tests/field_tests/test_emailfield.py
+++ b/tests/forms_tests/field_tests/test_emailfield.py
@@ -8,7 +8,7 @@ class EmailFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_emailfield_1(self):
f = EmailField()
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
f.clean('')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
@@ -41,7 +41,7 @@ class EmailFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
f = EmailField(min_length=10, max_length=15)
self.assertWidgetRendersTo(
f,
- ' ',
+ ' ',
)
with self.assertRaisesMessage(ValidationError, "'Ensure this value has at least 10 characters (it has 9).'"):
f.clean('a@foo.com')
diff --git a/tests/forms_tests/field_tests/test_floatfield.py b/tests/forms_tests/field_tests/test_floatfield.py
index b36942afa43..531396868ab 100644
--- a/tests/forms_tests/field_tests/test_floatfield.py
+++ b/tests/forms_tests/field_tests/test_floatfield.py
@@ -10,7 +10,7 @@ class FloatFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_floatfield_1(self):
f = FloatField()
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
f.clean('')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
@@ -49,7 +49,7 @@ class FloatFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
f = FloatField(max_value=1.5, min_value=0.5)
self.assertWidgetRendersTo(
f,
- ' ',
+ ' ',
)
with self.assertRaisesMessage(ValidationError, "'Ensure this value is less than or equal to 1.5.'"):
f.clean('1.6')
@@ -64,7 +64,7 @@ class FloatFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
f = FloatField(widget=NumberInput(attrs={'step': 0.01, 'max': 1.0, 'min': 0.0}))
self.assertWidgetRendersTo(
f,
- ' ',
+ ' ',
)
def test_floatfield_localized(self):
@@ -73,7 +73,7 @@ class FloatFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
number input specific attributes.
"""
f = FloatField(localize=True)
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
def test_floatfield_changed(self):
f = FloatField()
diff --git a/tests/forms_tests/field_tests/test_integerfield.py b/tests/forms_tests/field_tests/test_integerfield.py
index f89885027b6..a0cde409101 100644
--- a/tests/forms_tests/field_tests/test_integerfield.py
+++ b/tests/forms_tests/field_tests/test_integerfield.py
@@ -8,7 +8,7 @@ class IntegerFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_integerfield_1(self):
f = IntegerField()
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
f.clean('')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
@@ -50,7 +50,7 @@ class IntegerFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_integerfield_3(self):
f = IntegerField(max_value=10)
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
f.clean(None)
self.assertEqual(1, f.clean(1))
@@ -65,7 +65,7 @@ class IntegerFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_integerfield_4(self):
f = IntegerField(min_value=10)
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
f.clean(None)
with self.assertRaisesMessage(ValidationError, "'Ensure this value is greater than or equal to 10.'"):
@@ -79,7 +79,7 @@ class IntegerFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_integerfield_5(self):
f = IntegerField(min_value=10, max_value=20)
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
f.clean(None)
with self.assertRaisesMessage(ValidationError, "'Ensure this value is greater than or equal to 10.'"):
@@ -100,7 +100,7 @@ class IntegerFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
number input specific attributes.
"""
f1 = IntegerField(localize=True)
- self.assertWidgetRendersTo(f1, ' ')
+ self.assertWidgetRendersTo(f1, ' ')
def test_integerfield_float(self):
f = IntegerField()
diff --git a/tests/forms_tests/field_tests/test_multivaluefield.py b/tests/forms_tests/field_tests/test_multivaluefield.py
index edb32957e36..fb99451f6ca 100644
--- a/tests/forms_tests/field_tests/test_multivaluefield.py
+++ b/tests/forms_tests/field_tests/test_multivaluefield.py
@@ -128,15 +128,15 @@ class MultiValueFieldTest(SimpleTestCase):
form.as_table(),
"""
Field1:
-
+
John
Paul
George
Ringo
-
-
+
+
""",
)
@@ -151,15 +151,15 @@ class MultiValueFieldTest(SimpleTestCase):
form.as_table(),
"""
Field1:
-
+
John
Paul
George
Ringo
-
-
+
+
""",
)
diff --git a/tests/forms_tests/field_tests/test_nullbooleanfield.py b/tests/forms_tests/field_tests/test_nullbooleanfield.py
index ff57394f07c..55812612c99 100644
--- a/tests/forms_tests/field_tests/test_nullbooleanfield.py
+++ b/tests/forms_tests/field_tests/test_nullbooleanfield.py
@@ -27,8 +27,8 @@ class NullBooleanFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
hidden_nullbool2 = NullBooleanField(widget=HiddenInput, initial=False)
f = HiddenNullBooleanForm()
self.assertHTMLEqual(
- ' '
- ' ',
+ ' '
+ ' ',
str(f)
)
diff --git a/tests/forms_tests/field_tests/test_urlfield.py b/tests/forms_tests/field_tests/test_urlfield.py
index 2ecf1891127..52f1080cdc9 100644
--- a/tests/forms_tests/field_tests/test_urlfield.py
+++ b/tests/forms_tests/field_tests/test_urlfield.py
@@ -8,7 +8,7 @@ class URLFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_urlfield_1(self):
f = URLField()
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
f.clean('')
with self.assertRaisesMessage(ValidationError, "'This field is required.'"):
@@ -88,7 +88,7 @@ class URLFieldTest(FormFieldAssertionsMixin, SimpleTestCase):
def test_urlfield_5(self):
f = URLField(min_length=15, max_length=20)
- self.assertWidgetRendersTo(f, ' ')
+ self.assertWidgetRendersTo(f, ' ')
with self.assertRaisesMessage(ValidationError, "'Ensure this value has at least 15 characters (it has 12).'"):
f.clean('http://f.com')
self.assertEqual('http://example.com', f.clean('http://example.com'))
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index 4ec21f869e2..1f883e1a285 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -59,15 +59,15 @@ class FormsTestCase(SimpleTestCase):
self.assertEqual(p.cleaned_data["birthday"], datetime.date(1940, 10, 9))
self.assertHTMLEqual(
str(p['first_name']),
- ' '
+ ' '
)
self.assertHTMLEqual(
str(p['last_name']),
- ' '
+ ' '
)
self.assertHTMLEqual(
str(p['birthday']),
- ' '
+ ' '
)
msg = "Key 'nonexistentfield' not found in 'Person'. Choices are: birthday, first_name, last_name."
@@ -81,9 +81,9 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
'\n'.join(form_output),
- """
-
- """
+ """
+
+ """
)
form_output = []
@@ -99,11 +99,11 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
str(p),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
def test_empty_dict(self):
@@ -119,49 +119,49 @@ class FormsTestCase(SimpleTestCase):
str(p),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
self.assertHTMLEqual(
p.as_table(),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
self.assertHTMLEqual(
p.as_ul(),
"""
First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
self.assertHTMLEqual(
p.as_p(),
"""
First name:
-
+
Last name:
-
+
Birthday:
-
"""
+ """
)
def test_empty_querydict_args(self):
@@ -185,38 +185,38 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
str(p),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
self.assertHTMLEqual(
p.as_table(),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
self.assertHTMLEqual(
p.as_ul(),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
self.assertHTMLEqual(
p.as_p(),
"""First name:
-
+
Last name:
-
+
Birthday:
-
"""
+ """
)
def test_unicode_values(self):
@@ -229,33 +229,33 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
p.as_table(),
'First name: '
- ' \n'
+ ' \n'
'Last name: '
' \n'
+ 'id="id_last_name" required>\n'
'Birthday: '
- ' '
+ ' '
)
self.assertHTMLEqual(
p.as_ul(),
'First name: '
- ' \n'
+ ' \n'
'Last name: '
' \n'
+ 'value="\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111" id="id_last_name" required>\n'
'Birthday: '
- ' '
+ ' '
)
self.assertHTMLEqual(
p.as_p(),
'First name: '
- '
\n'
+ ' \n'
'Last name: '
'
\n'
+ 'value="\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111" id="id_last_name" required>\n'
'Birthday: '
- '
'
+ ' '
)
p = Person({'last_name': 'Lennon'})
@@ -277,10 +277,10 @@ class FormsTestCase(SimpleTestCase):
p = Person()
self.assertHTMLEqual(
str(p['first_name']),
- ' ',
+ ' ',
)
- self.assertHTMLEqual(str(p['last_name']), ' ')
- self.assertHTMLEqual(str(p['birthday']), ' ')
+ self.assertHTMLEqual(str(p['last_name']), ' ')
+ self.assertHTMLEqual(str(p['birthday']), ' ')
def test_cleaned_data_only_fields(self):
# cleaned_data will always *only* contain a key for fields defined in the
@@ -340,29 +340,29 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
p.as_table(),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
self.assertHTMLEqual(
p.as_ul(),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
self.assertHTMLEqual(
p.as_p(),
"""First name:
-
+
Last name:
-
+
Birthday:
-
"""
+ """
)
def test_auto_id_true(self):
@@ -372,11 +372,11 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
p.as_ul(),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
def test_auto_id_false(self):
@@ -385,9 +385,9 @@ class FormsTestCase(SimpleTestCase):
p = Person(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """First name:
-Last name:
-Birthday: """
+ """First name:
+Last name:
+Birthday: """
)
def test_id_on_field(self):
@@ -397,9 +397,9 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
p.as_ul(),
"""First name:
-
-Last name:
-Birthday: """
+
+Last name:
+Birthday: """
)
def test_auto_id_on_form_and_field(self):
@@ -409,11 +409,11 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
p.as_ul(),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
def test_various_boolean_values(self):
@@ -422,33 +422,33 @@ class FormsTestCase(SimpleTestCase):
get_spam = BooleanField()
f = SignupForm(auto_id=False)
- self.assertHTMLEqual(str(f['email']), ' ')
- self.assertHTMLEqual(str(f['get_spam']), ' ')
+ self.assertHTMLEqual(str(f['email']), ' ')
+ self.assertHTMLEqual(str(f['get_spam']), ' ')
f = SignupForm({'email': 'test@example.com', 'get_spam': True}, auto_id=False)
- self.assertHTMLEqual(str(f['email']), ' ')
+ self.assertHTMLEqual(str(f['email']), ' ')
self.assertHTMLEqual(
str(f['get_spam']),
- ' ',
+ ' ',
)
# 'True' or 'true' should be rendered without a value attribute
f = SignupForm({'email': 'test@example.com', 'get_spam': 'True'}, auto_id=False)
self.assertHTMLEqual(
str(f['get_spam']),
- ' ',
+ ' ',
)
f = SignupForm({'email': 'test@example.com', 'get_spam': 'true'}, auto_id=False)
self.assertHTMLEqual(
- str(f['get_spam']), ' ')
+ str(f['get_spam']), ' ')
# A value of 'False' or 'false' should be rendered unchecked
f = SignupForm({'email': 'test@example.com', 'get_spam': 'False'}, auto_id=False)
- self.assertHTMLEqual(str(f['get_spam']), ' ')
+ self.assertHTMLEqual(str(f['get_spam']), ' ')
f = SignupForm({'email': 'test@example.com', 'get_spam': 'false'}, auto_id=False)
- self.assertHTMLEqual(str(f['get_spam']), ' ')
+ self.assertHTMLEqual(str(f['get_spam']), ' ')
# A value of '0' should be interpreted as a True value (#16820)
f = SignupForm({'email': 'test@example.com', 'get_spam': '0'})
@@ -462,7 +462,7 @@ class FormsTestCase(SimpleTestCase):
message = CharField(widget=Textarea)
f = ContactForm(auto_id=False)
- self.assertHTMLEqual(str(f['subject']), ' ')
+ self.assertHTMLEqual(str(f['subject']), ' ')
self.assertHTMLEqual(str(f['message']), '')
# as_textarea(), as_text() and as_hidden() are shortcuts for changing the output
@@ -471,8 +471,8 @@ class FormsTestCase(SimpleTestCase):
f['subject'].as_textarea(),
'',
)
- self.assertHTMLEqual(f['message'].as_text(), ' ')
- self.assertHTMLEqual(f['message'].as_hidden(), ' ')
+ self.assertHTMLEqual(f['message'].as_text(), ' ')
+ self.assertHTMLEqual(f['message'].as_hidden(), ' ')
# The 'widget' parameter to a Field can also be an instance:
class ContactForm(Form):
@@ -484,7 +484,7 @@ class FormsTestCase(SimpleTestCase):
# Instance-level attrs are *not* carried over to as_textarea(), as_text() and
# as_hidden():
- self.assertHTMLEqual(f['message'].as_text(), ' ')
+ self.assertHTMLEqual(f['message'].as_text(), ' ')
f = ContactForm({'subject': 'Hello', 'message': 'I love you.'}, auto_id=False)
self.assertHTMLEqual(
f['subject'].as_textarea(),
@@ -492,9 +492,9 @@ class FormsTestCase(SimpleTestCase):
)
self.assertHTMLEqual(
f['message'].as_text(),
- ' ',
+ ' ',
)
- self.assertHTMLEqual(f['message'].as_hidden(), ' ')
+ self.assertHTMLEqual(f['message'].as_hidden(), ' ')
def test_forms_with_choices(self):
# For a form with a , use ChoiceField:
@@ -585,18 +585,18 @@ class FormsTestCase(SimpleTestCase):
f = FrameworkForm(auto_id=False)
self.assertHTMLEqual(str(f['language']), """""")
- self.assertHTMLEqual(f.as_table(), """Name:
+ self.assertHTMLEqual(f.as_table(), """Name:
Language: """)
- self.assertHTMLEqual(f.as_ul(), """Name:
+ self.assertHTMLEqual(f.as_ul(), """Name:
Language: """)
# Regarding auto_id and , RadioSelect is a special case. Each radio button
@@ -606,9 +606,9 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
str(f['language']),
""""""
)
@@ -618,31 +618,31 @@ Java
# ID of the *first* radio button.
self.assertHTMLEqual(
f.as_table(),
- """Name:
+ """Name:
Language: """
)
self.assertHTMLEqual(
f.as_ul(),
- """Name:
+ """Name:
Language: """
)
self.assertHTMLEqual(
f.as_p(),
- """Name:
+ """Name:
Language:
"""
)
@@ -652,9 +652,9 @@ Java
self.assertHTMLEqual(
t.render(Context({'form': f})),
"""
- Python
+ Python
- Java
"""
+ Java"""
)
def test_form_with_iterable_boundfield(self):
@@ -667,17 +667,17 @@ Java
f = BeatleForm(auto_id=False)
self.assertHTMLEqual(
'\n'.join(str(bf) for bf in f['name']),
- """ John
- Paul
- George
- Ringo """
+ """ John
+ Paul
+ George
+ Ringo """
)
self.assertHTMLEqual(
'\n'.join('%s
' % bf for bf in f['name']),
- """ John
- Paul
- George
- Ringo
"""
+ """ John
+ Paul
+ George
+ Ringo
"""
)
def test_form_with_iterable_boundfield_id(self):
@@ -693,24 +693,24 @@ Java
self.assertEqual(fields[0].choice_label, 'John')
self.assertHTMLEqual(
fields[0].tag(),
- ' '
+ ' '
)
self.assertHTMLEqual(
str(fields[0]),
' John '
+ 'value="john" id="id_name_0" required> John'
)
self.assertEqual(fields[1].id_for_label, 'id_name_1')
self.assertEqual(fields[1].choice_label, 'Paul')
self.assertHTMLEqual(
fields[1].tag(),
- ' '
+ ' '
)
self.assertHTMLEqual(
str(fields[1]),
' Paul '
+ 'value="paul" id="id_name_1" required> Paul'
)
def test_iterable_boundfield_select(self):
@@ -730,7 +730,7 @@ Java
name = CharField()
f = BeatleForm(auto_id=False)
- self.assertHTMLEqual('\n'.join(str(bf) for bf in f['name']), ' ')
+ self.assertHTMLEqual('\n'.join(str(bf) for bf in f['name']), ' ')
def test_boundfield_slice(self):
class BeatleForm(Form):
@@ -773,7 +773,7 @@ Java
Paul McCartney
""")
f = SongForm({'name': 'Yesterday', 'composers': ['P']}, auto_id=False)
- self.assertHTMLEqual(str(f['name']), ' ')
+ self.assertHTMLEqual(str(f['name']), ' ')
self.assertHTMLEqual(str(f['composers']), """
John Lennon
Paul McCartney
@@ -827,10 +827,10 @@ Java
# have multiple values, its as_hidden() renders multiple
# tags.
f = SongForm({'name': 'Yesterday', 'composers': ['P']}, auto_id=False)
- self.assertHTMLEqual(f['composers'].as_hidden(), ' ')
+ self.assertHTMLEqual(f['composers'].as_hidden(), ' ')
f = SongForm({'name': 'From Me To You', 'composers': ['P', 'J']}, auto_id=False)
- self.assertHTMLEqual(f['composers'].as_hidden(), """
- """)
+ self.assertHTMLEqual(f['composers'].as_hidden(), """
+ """)
# DateTimeField rendered as_hidden() is special too
class MessageForm(Form):
@@ -840,13 +840,13 @@ Java
self.assertTrue(f.is_valid())
self.assertHTMLEqual(
str(f['when']),
- ' '
- ' '
+ ' '
+ ' '
)
self.assertHTMLEqual(
f['when'].as_hidden(),
- ' '
- ' '
+ ' '
+ ' '
)
def test_multiple_choice_checkbox(self):
@@ -860,25 +860,25 @@ Java
f = SongForm(auto_id=False)
self.assertHTMLEqual(str(f['composers']), """""")
f = SongForm({'composers': ['J']}, auto_id=False)
self.assertHTMLEqual(str(f['composers']), """""")
f = SongForm({'composers': ['J', 'P']}, auto_id=False)
self.assertHTMLEqual(str(f['composers']), """""")
# Test iterating on individual checkboxes in a template
t = Template('{% for checkbox in form.composers %}{{ checkbox }}
{% endfor %}')
self.assertHTMLEqual(t.render(Context({'form': f})), """
- John Lennon
+ John Lennon
- Paul McCartney
""")
+ Paul McCartney""")
def test_checkbox_auto_id(self):
# Regarding auto_id, CheckboxSelectMultiple is a special case. Each checkbox
@@ -896,9 +896,9 @@ Java
str(f['composers']),
""""""
)
@@ -949,9 +949,9 @@ Java
f = SongFormHidden(MultiValueDict({'name': ['Yesterday'], 'composers': ['J', 'P']}), auto_id=False)
self.assertHTMLEqual(
f.as_ul(),
- """Name:
-
- """
+ """Name:
+
+ """
)
# When using CheckboxSelectMultiple, the framework expects a list of input and
@@ -996,10 +996,10 @@ Java
f.as_table(),
"""<em>Special</em> Field:
Something's wrong with 'Nothing to escape'
-
+
Special Field:
'Nothing to escape ' is a safe string
- """
+ """
)
f = EscapingForm({
'special_name': "Should escape < & > and ",
@@ -1011,10 +1011,10 @@ Java
Something's wrong with 'Should escape < & > and
<script>alert('xss')</script>'
+value="Should escape < & > and <script>alert('xss')</script>" required>
Special Field:
'Do not escape ' is a safe string
- """
+ """
)
def test_validating_multiple_fields(self):
@@ -1101,11 +1101,11 @@ value="Should escape < & > and <script>alert('xss')</
f.as_table(),
"""Username:
-
+
Password1:
-
+
Password2:
- """
+ """
)
self.assertEqual(f.errors['username'], ['This field is required.'])
self.assertEqual(f.errors['password1'], ['This field is required.'])
@@ -1117,17 +1117,17 @@ value="Should escape < & > and <script>alert('xss')</
f.as_table(),
"""
Please make sure your passwords match.
-Username:
-Password1:
-Password2: """
+Username:
+Password1:
+Password2: """
)
self.assertHTMLEqual(
f.as_ul(),
"""
Please make sure your passwords match.
-Username:
-Password1:
-Password2: """
+Username:
+Password1:
+Password2: """
)
f = UserRegistration({'username': 'adrian', 'password1': 'foo', 'password2': 'foo'}, auto_id=False)
@@ -1251,9 +1251,9 @@ value="Should escape < & > and <script>alert('xss')</
p = Person(auto_id=False)
self.assertHTMLEqual(
p.as_table(),
- """First name:
-Last name:
-Birthday: """
+ """First name:
+Last name:
+Birthday: """
)
# Instances of a dynamic Form do not persist fields from one Form instance to
@@ -1269,15 +1269,15 @@ value="Should escape < & > and <script>alert('xss')</
my_form = MyForm(field_list=field_list)
self.assertHTMLEqual(
my_form.as_table(),
- """Field1:
-Field2: """
+ """Field1:
+Field2: """
)
field_list = [('field3', CharField()), ('field4', CharField())]
my_form = MyForm(field_list=field_list)
self.assertHTMLEqual(
my_form.as_table(),
- """Field3:
-Field4: """
+ """Field3:
+Field4: """
)
class MyForm(Form):
@@ -1294,19 +1294,19 @@ value="Should escape < & > and <script>alert('xss')</
my_form = MyForm(field_list=field_list)
self.assertHTMLEqual(
my_form.as_table(),
- """Default field 1:
-Default field 2:
-Field1:
-Field2: """
+ """Default field 1:
+Default field 2:
+Field1:
+Field2: """
)
field_list = [('field3', CharField()), ('field4', CharField())]
my_form = MyForm(field_list=field_list)
self.assertHTMLEqual(
my_form.as_table(),
- """Default field 1:
-Default field 2:
-Field3:
-Field4: """
+ """Default field 1:
+Default field 2:
+Field3:
+Field4: """
)
# Similarly, changes to field attributes do not persist from one Form instance
@@ -1404,21 +1404,21 @@ value="Should escape < & > and <script>alert('xss')</
p = Person(auto_id=False)
self.assertHTMLEqual(
p.as_table(),
- """First name:
-Last name:
+ """First name:
+Last name:
Birthday:
- """
+ """
)
self.assertHTMLEqual(
p.as_ul(),
- """First name:
-Last name:
-Birthday: """
+ """First name:
+Last name:
+Birthday: """
)
self.assertHTMLEqual(
- p.as_p(), """First name:
-Last name:
-Birthday:
"""
+ p.as_p(), """First name:
+Last name:
+Birthday:
"""
)
# With auto_id set, a HiddenInput still gets an ID, but it doesn't get a label.
@@ -1426,32 +1426,32 @@ value="Should escape < & > and <script>alert('xss')</
self.assertHTMLEqual(
p.as_table(),
"""First name:
-
+
Last name:
-
+
Birthday:
-
- """
+
+ """
)
self.assertHTMLEqual(
p.as_ul(),
"""First name:
-
+
Last name:
-
+
Birthday:
-
- """
+
+ """
)
self.assertHTMLEqual(
p.as_p(),
"""First name:
-
+
Last name:
-
+
Birthday:
-
-
"""
+
+ """
)
# If a field with a HiddenInput has errors, the as_table() and as_ul() output
@@ -1463,26 +1463,26 @@ value="Should escape < & > and <script>alert('xss')</
p.as_table(),
"""
(Hidden field hidden_text) This field is required.
-First name:
-Last name:
-Birthday:
- """
+First name:
+Last name:
+Birthday:
+ """
)
self.assertHTMLEqual(
p.as_ul(),
"""(Hidden field hidden_text) This field is required.
-First name:
-Last name:
-Birthday:
- """
+First name:
+Last name:
+Birthday:
+ """
)
self.assertHTMLEqual(
p.as_p(),
"""(Hidden field hidden_text) This field is required.
-First name:
-Last name:
-Birthday:
-
"""
+First name:
+Last name:
+Birthday:
+
"""
)
# A corner case: It's possible for a form to have only HiddenInputs.
@@ -1491,9 +1491,9 @@ value="Should escape < & > and <script>alert('xss')</
bar = CharField(widget=HiddenInput)
p = TestForm(auto_id=False)
- self.assertHTMLEqual(p.as_table(), ' ')
- self.assertHTMLEqual(p.as_ul(), ' ')
- self.assertHTMLEqual(p.as_p(), ' ')
+ self.assertHTMLEqual(p.as_table(), ' ')
+ self.assertHTMLEqual(p.as_ul(), ' ')
+ self.assertHTMLEqual(p.as_p(), ' ')
def test_field_order(self):
# A Form's fields are displayed in the same order in which they were defined.
@@ -1514,20 +1514,20 @@ value="Should escape < & > and <script>alert('xss')</
field14 = CharField()
p = TestForm(auto_id=False)
- self.assertHTMLEqual(p.as_table(), """Field1:
-Field2:
-Field3:
-Field4:
-Field5:
-Field6:
-Field7:
-Field8:
-Field9:
-Field10:
-Field11:
-Field12:
-Field13:
-Field14: """)
+ self.assertHTMLEqual(p.as_table(), """Field1:
+Field2:
+Field3:
+Field4:
+Field5:
+Field6:
+Field7:
+Field8:
+Field9:
+Field10:
+Field11:
+Field12:
+Field13:
+Field14: """)
def test_explicit_field_order(self):
class TestFormParent(Form):
@@ -1586,10 +1586,10 @@ value="Should escape < & > and <script>alert('xss')</
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password:
-Realname:
-Address: """
+ """Username:
+Password:
+Realname:
+Address: """
)
# If you specify a custom "attrs" that includes the "maxlength" attribute,
@@ -1602,8 +1602,8 @@ value="Should escape < & > and <script>alert('xss')</
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password: """
+ """Username:
+Password: """
)
def test_specifying_labels(self):
@@ -1618,9 +1618,9 @@ value="Should escape < & > and <script>alert('xss')</
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Your username:
-Password1:
-Contraseña (de nuevo): """
+ """Your username:
+Password1:
+Contraseña (de nuevo): """
)
# Labels for as_* methods will only end in a colon if they don't end in other
@@ -1634,19 +1634,19 @@ value="Should escape < & > and <script>alert('xss')</
self.assertHTMLEqual(
Questions(auto_id=False).as_p(),
- """The first question:
-What is your name?
-The answer to life is:
-Answer this question!
-The last question. Period.
"""
+ """The first question:
+What is your name?
+The answer to life is:
+Answer this question!
+The last question. Period.
"""
)
self.assertHTMLEqual(
Questions().as_p(),
- """The first question:
-What is your name?
-The answer to life is:
-Answer this question!
-The last question. Period.
"""
+ """The first question:
+What is your name?
+The answer to life is:
+Answer this question!
+The last question. Period.
"""
)
# If a label is set to the empty string for a field, that field won't get a label.
@@ -1655,14 +1655,14 @@ value="Should escape < & > and <script>alert('xss')</
password = CharField(widget=PasswordInput)
p = UserRegistration(auto_id=False)
- self.assertHTMLEqual(p.as_ul(), """
-Password: """)
+ self.assertHTMLEqual(p.as_ul(), """
+Password: """)
p = UserRegistration(auto_id='id_%s')
self.assertHTMLEqual(
p.as_ul(),
- """
+ """
Password:
- """
+ """
)
# If label is None, Django will auto-create the label from the field name. This
@@ -1674,16 +1674,16 @@ value="Should escape < & > and <script>alert('xss')</
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password: """
+ """Username:
+Password: """
)
p = UserRegistration(auto_id='id_%s')
self.assertHTMLEqual(
p.as_ul(),
"""Username:
-
+
Password:
- """
+ """
)
def test_label_suffix(self):
@@ -1698,26 +1698,26 @@ value="Should escape < & > and <script>alert('xss')</
answer = CharField(label='Secret answer', label_suffix=' =')
f = FavoriteForm(auto_id=False)
- self.assertHTMLEqual(f.as_ul(), """Favorite color?
-Favorite animal:
-Secret answer = """)
+ self.assertHTMLEqual(f.as_ul(), """Favorite color?
+Favorite animal:
+Secret answer = """)
f = FavoriteForm(auto_id=False, label_suffix='?')
- self.assertHTMLEqual(f.as_ul(), """Favorite color?
-Favorite animal?
-Secret answer = """)
+ self.assertHTMLEqual(f.as_ul(), """Favorite color?
+Favorite animal?
+Secret answer = """)
f = FavoriteForm(auto_id=False, label_suffix='')
- self.assertHTMLEqual(f.as_ul(), """Favorite color?
-Favorite animal
-Secret answer = """)
+ self.assertHTMLEqual(f.as_ul(), """Favorite color?
+Favorite animal
+Secret answer = """)
f = FavoriteForm(auto_id=False, label_suffix='\u2192')
self.assertHTMLEqual(
f.as_ul(),
- 'Favorite color? \n'
- 'Favorite animal\u2192 \n'
- 'Secret answer = '
+ 'Favorite color? \n'
+ 'Favorite animal\u2192 \n'
+ 'Secret answer = '
)
def test_initial_data(self):
@@ -1734,8 +1734,8 @@ value="Should escape < & > and <script>alert('xss')</
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password: """
+ """Username:
+Password: """
)
# Here, we're submitting data, so the initial value will *not* be displayed.
@@ -1743,24 +1743,24 @@ value="Should escape < & > and <script>alert('xss')</
self.assertHTMLEqual(
p.as_ul(),
"""
-Username:
+Username:
-Password: """
+Password: """
)
p = UserRegistration({'username': ''}, auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
"""
-Username:
+Username:
-Password: """
+Password: """
)
p = UserRegistration({'username': 'foo'}, auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
+ """Username:
-Password: """
+Password: """
)
# An 'initial' value is *not* used as a fallback if data is not provided. In this
@@ -1784,14 +1784,14 @@ Password: """
p = UserRegistration(initial={'username': 'django'}, auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password: """
+ """Username:
+Password: """
)
p = UserRegistration(initial={'username': 'stephane'}, auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password: """
+ """Username:
+Password: """
)
# The 'initial' parameter is meaningless if you pass data.
@@ -1799,23 +1799,23 @@ Password: """
self.assertHTMLEqual(
p.as_ul(),
"""
-Username:
+Username:
-Password: """
+Password: """
)
p = UserRegistration({'username': ''}, initial={'username': 'django'}, auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
"""
-Username:
+Username:
-Password: """
+Password: """
)
p = UserRegistration({'username': 'foo'}, initial={'username': 'django'}, auto_id=False)
self.assertHTMLEqual(
- p.as_ul(), """Username:
+ p.as_ul(), """Username:
-Password: """
+Password: """
)
# A dynamic 'initial' value is *not* used as a fallback if data is not provided.
@@ -1834,8 +1834,8 @@ Password: """
p = UserRegistration(initial={'username': 'babik'}, auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password: """
+ """Username:
+Password: """
)
def test_callable_initial_data(self):
@@ -1863,8 +1863,8 @@ Password: """
p = UserRegistration(initial={'username': initial_django, 'options': initial_options}, auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password:
+ """Username:
+Password:
Options:
foo
bar
@@ -1877,9 +1877,9 @@ Password: """
self.assertHTMLEqual(
p.as_ul(),
"""
-Username:
+Username:
-Password:
+Password:
Options:
foo
@@ -1891,9 +1891,9 @@ Options:
self.assertHTMLEqual(
p.as_ul(),
"""
- Username:
+ Username:
-Password:
+Password:
Options:
foo
@@ -1906,9 +1906,9 @@ Options:
)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
+ """Username:
-Password:
+Password:
Options:
foo
bar
@@ -1936,8 +1936,8 @@ Password:
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password:
+ """Username:
+Password:
Options:
foo
bar
@@ -1947,8 +1947,8 @@ Password:
p = UserRegistration(initial={'username': initial_stephane, 'options': initial_options}, auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
-Password:
+ """Username:
+Password:
Options:
foo
bar
@@ -2112,23 +2112,23 @@ Password:
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
+ """ Username:
e.g., user@example.com
-Password:
+ Password:
Wählen Sie mit Bedacht. """
)
self.assertHTMLEqual(
p.as_p(),
- """Username:
+ """
Username:
e.g., user@example.com
-Password:
+
Password:
Wählen Sie mit Bedacht.
"""
)
self.assertHTMLEqual(
p.as_table(),
- """Username:
+ """Username:
e.g., user@example.com
-Password:
+Password:
Wählen Sie mit Bedacht. """
)
@@ -2136,10 +2136,10 @@ Password:
p = UserRegistration({'username': 'foo'}, auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
+ """ Username:
e.g., user@example.com
-Password:
+Password:
Wählen Sie mit Bedacht. """
)
@@ -2153,10 +2153,10 @@ Password:
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """Username:
+ """ Username:
e.g., user@example.com
-Password:
- """
+Password:
+ """
)
def test_subclassing_forms(self):
@@ -2174,17 +2174,17 @@ Password:
p = Person(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """First name:
-Last name:
-Birthday: """
+ """First name:
+Last name:
+Birthday: """
)
m = Musician(auto_id=False)
self.assertHTMLEqual(
m.as_ul(),
- """First name:
-Last name:
-Birthday:
-Instrument: """
+ """First name:
+Last name:
+Birthday:
+Instrument: """
)
# Yes, you can subclass multiple forms. The fields are added in the order in
@@ -2201,11 +2201,11 @@ Password:
haircut_type = CharField()
b = Beatle(auto_id=False)
- self.assertHTMLEqual(b.as_ul(), """Instrument:
-First name:
-Last name:
-Birthday:
-Haircut type: """)
+ self.assertHTMLEqual(b.as_ul(), """Instrument:
+First name:
+Last name:
+Birthday:
+Haircut type: """)
def test_forms_with_prefixes(self):
# Sometimes it's necessary to have multiple forms display on the same HTML page,
@@ -2229,23 +2229,23 @@ Password:
self.assertHTMLEqual(
p.as_ul(),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
self.assertHTMLEqual(
str(p['first_name']),
- ' '
+ ' '
)
self.assertHTMLEqual(
str(p['last_name']),
- ' '
+ ' '
)
self.assertHTMLEqual(
str(p['birthday']),
- ' '
+ ' '
)
self.assertEqual(p.errors, {})
self.assertTrue(p.is_valid())
@@ -2318,11 +2318,11 @@ Password:
self.assertHTMLEqual(
p.as_ul(),
"""First name:
-
+
Last name:
-
+
Birthday:
- """
+ """
)
data = {
'foo-prefix-first_name': 'John',
@@ -2400,7 +2400,7 @@ Password:
f = FileForm(auto_id=False)
self.assertHTMLEqual(
f.as_table(),
- 'File1: ',
+ 'File1: ',
)
f = FileForm(data={}, files={}, auto_id=False)
@@ -2408,7 +2408,7 @@ Password:
f.as_table(),
'File1: '
''
- ' '
+ ' '
)
f = FileForm(data={}, files={'file1': SimpleUploadedFile('name', b'')}, auto_id=False)
@@ -2416,7 +2416,7 @@ Password:
f.as_table(),
'File1: '
'The submitted file is empty. '
- ' '
+ ' '
)
f = FileForm(data={}, files={'file1': 'something that is not a file'}, auto_id=False)
@@ -2425,13 +2425,13 @@ Password:
'File1: '
'No file was submitted. Check the '
'encoding type on the form. '
- ' '
+ ' '
)
f = FileForm(data={}, files={'file1': SimpleUploadedFile('name', b'some content')}, auto_id=False)
self.assertHTMLEqual(
f.as_table(),
- 'File1: ',
+ 'File1: ',
)
self.assertTrue(f.is_valid())
@@ -2439,7 +2439,7 @@ Password:
f = FileForm(data={}, files={'file1': file1}, auto_id=False)
self.assertHTMLEqual(
f.as_table(),
- 'File1: ',
+ 'File1: ',
)
# A required file field with initial data should not contain the
@@ -2448,7 +2448,7 @@ Password:
f = FileForm(initial={'file1': 'resume.txt'}, auto_id=False)
self.assertHTMLEqual(
f.as_table(),
- 'File1: ',
+ 'File1: ',
)
def test_filefield_initial_callable(self):
@@ -2483,18 +2483,18 @@ Password:
t = Template(
''
+ '\n \n'
)
return t.render(Context({'form': form}))
# Case 1: GET (an empty form, with no errors).)
self.assertHTMLEqual(my_function('GET', {}), """""")
# Case 2: POST with erroneous data (a redisplayed form, with errors).)
self.assertHTMLEqual(
@@ -2504,11 +2504,11 @@ Password:
Please make sure your passwords match.
Username:
Ensure this value has at most 10 characters (it has 23).
-
-Password1:
-Password2:
+
+Password1:
+Password2:
-
+
"""
)
# Case 3: POST with valid data (the success message).)
@@ -2539,23 +2539,23 @@ Password:
{{ form.username.errors.as_ul }}Your username: {{ form.username }}
{{ form.password1.errors.as_ul }}Password: {{ form.password1 }}
{{ form.password2.errors.as_ul }}Password (again): {{ form.password2 }}
-
+
''')
self.assertHTMLEqual(t.render(Context({'form': UserRegistration(auto_id=False)})), """""")
self.assertHTMLEqual(
t.render(Context({'form': UserRegistration({'username': 'django'}, auto_id=False)})),
""""""
)
@@ -2567,13 +2567,13 @@ Password:
{{ form.username.label }}: {{ form.username }}
{{ form.password1.label }}: {{ form.password1 }}
{{ form.password2.label }}: {{ form.password2 }}
-
+
''')
self.assertHTMLEqual(t.render(Context({'form': UserRegistration(auto_id=False)})), """""")
# User form.[field].label_tag to output a field's label with a tag
@@ -2584,40 +2584,40 @@ Password:
{{ form.username.label_tag }} {{ form.username }}
{{ form.password1.label_tag }} {{ form.password1 }}
{{ form.password2.label_tag }} {{ form.password2 }}
-
+
''')
self.assertHTMLEqual(t.render(Context({'form': UserRegistration(auto_id=False)})), """""")
self.assertHTMLEqual(t.render(Context({'form': UserRegistration(auto_id='id_%s')})), """""")
# User form.[field].help_text to output a field's help text. If the given field
# does not have help text, nothing will be output.
t = Template('''''')
self.assertHTMLEqual(
t.render(Context({'form': UserRegistration(auto_id=False)})),
""""""
)
self.assertEqual(
@@ -2633,17 +2633,17 @@ Good luck picking a username that doesn't already exist.
{{ form.username.errors.as_ul }}Your username: {{ form.username }}
{{ form.password1.errors.as_ul }}Password: {{ form.password1 }}
{{ form.password2.errors.as_ul }}Password (again): {{ form.password2 }}
-
+
''')
self.assertHTMLEqual(
t.render(Context({
'form': UserRegistration({'username': 'django', 'password1': 'foo', 'password2': 'bar'}, auto_id=False)
})),
""""""
)
t = Template('''''')
self.assertHTMLEqual(
t.render(Context({
@@ -2659,10 +2659,10 @@ Good luck picking a username that doesn't already exist.
})),
""""""
)
@@ -2729,8 +2729,8 @@ Good luck picking a username that doesn't already exist.
self.assertHTMLEqual(
MyForm().as_table(),
'Field1: '
- ' '
- ' '
+ ' '
+ ' '
)
def test_error_html_required_html_classes(self):
@@ -2747,33 +2747,33 @@ Good luck picking a username that doesn't already exist.
self.assertHTMLEqual(
p.as_ul(),
"""
-Name:
+Name:
Is cool:
Unknown
Yes
No
-Email:
+Email:
-Age: """
+Age: """
)
self.assertHTMLEqual(
p.as_p(),
"""
Name:
-
+
Is cool:
Unknown
Yes
No
-Email:
+Email:
Age:
-
"""
+ """
)
self.assertHTMLEqual(
@@ -2781,7 +2781,7 @@ Good luck picking a username that doesn't already exist.
"""
Name:
-
+
Is cool:
Unknown
@@ -2789,10 +2789,10 @@ Good luck picking a username that doesn't already exist.
No
Email:
-
+
Age:
- """
+ """
)
def test_label_has_required_css_class(self):
@@ -2819,8 +2819,8 @@ Good luck picking a username that doesn't already exist.
form = EventForm()
self.assertHTMLEqual(
form.as_ul(),
- ' '
- ' '
+ ' '
+ ' '
)
def test_multivalue_field_validation(self):
@@ -3155,9 +3155,9 @@ Good luck picking a username that doesn't already exist.
form = SomeForm()
self.assertHTMLEqual(
form.as_p(),
- ' custom'
- ' '
- '
'
+ ' custom'
+ ' '
+ '
'
)
def test_field_name_with_hidden_input_and_non_matching_row_ender(self):
@@ -3174,7 +3174,7 @@ Good luck picking a username that doesn't already exist.
return self._html_output(
normal_row='%(field)s %(field_name)s
',
error_row='%s',
- row_ender=' ',
+ row_ender=' ',
help_text_html=' %s',
errors_on_separate_row=True
)
@@ -3182,9 +3182,9 @@ Good luck picking a username that doesn't already exist.
form = SomeForm()
self.assertHTMLEqual(
form.as_p(),
- ' custom
\n'
- ' '
- ' '
+ ' custom
\n'
+ ' '
+ ' '
)
def test_error_dict(self):
@@ -3312,23 +3312,23 @@ Good luck picking a username that doesn't already exist.
"""
(Hidden field last_name) This field is required.
First name:
-
- """
+
+ """
)
self.assertHTMLEqual(
p.as_p(),
"""(Hidden field last_name) This field is required.
First name:
-
-
"""
+
+ """
)
self.assertHTMLEqual(
p.as_table(),
"""
(Hidden field last_name) This field is required.
First name:
-
- """
+
+ """
)
def test_error_list_with_non_field_errors_has_correct_class(self):
@@ -3349,9 +3349,9 @@ Good luck picking a username that doesn't already exist.
"""
First name:
-
+
Last name:
- """
+ """
)
self.assertHTMLEqual(
p.non_field_errors().as_text(),
@@ -3361,17 +3361,17 @@ Good luck picking a username that doesn't already exist.
p.as_p(),
"""
First name:
-
+
Last name:
-
"""
+ """
)
self.assertHTMLEqual(
p.as_table(),
"""
First name:
-
+
Last name:
- """
+ """
)
def test_errorlist_override(self):
@@ -3392,11 +3392,11 @@ Good luck picking a username that doesn't already exist.
data = {'email': 'invalid'}
f = CommentForm(data, auto_id=False, error_class=DivErrorList)
- self.assertHTMLEqual(f.as_p(), """Name:
+ self.assertHTMLEqual(f.as_p(), """Name:
Enter a valid email address.
-Email:
+Email:
-Comment:
""")
+Comment:
""")
def test_error_escaping(self):
class TestForm(Form):
@@ -3415,8 +3415,8 @@ Good luck picking a username that doesn't already exist.
'(Hidden field hidden) Foo & "bar"! '
''
'Visible: '
- ' '
- ' '
+ ' '
+ ' '
)
def test_baseform_repr(self):
@@ -3529,8 +3529,8 @@ Good luck picking a username that doesn't already exist.
form = MyForm()
self.assertHTMLEqual(
form.as_p(),
- 'F1:
'
- 'F2:
'
+ 'F1:
'
+ 'F2:
'
'F3:
'
'F4: '
@@ -3541,8 +3541,8 @@ Good luck picking a username that doesn't already exist.
self.assertHTMLEqual(
form.as_ul(),
'F1: '
- ' '
- 'F2: '
+ ' '
+ 'F2: '
'F3: '
'F4: '
@@ -3553,9 +3553,9 @@ Good luck picking a username that doesn't already exist.
self.assertHTMLEqual(
form.as_table(),
'F1: '
- ' '
+ ' '
'F2: '
- ' '
+ ' '
'F3: '
' '
@@ -3576,8 +3576,8 @@ Good luck picking a username that doesn't already exist.
form = MyForm()
self.assertHTMLEqual(
form.as_p(),
- 'F1:
'
- 'F2:
'
+ 'F1:
'
+ 'F2:
'
'F3:
'
'F4: '
@@ -3587,8 +3587,8 @@ Good luck picking a username that doesn't already exist.
)
self.assertHTMLEqual(
form.as_ul(),
- 'F1: '
- 'F2: '
+ 'F1: '
+ 'F2: '
'F3: '
'F4: '
@@ -3599,9 +3599,9 @@ Good luck picking a username that doesn't already exist.
self.assertHTMLEqual(
form.as_table(),
'F1: '
- ' '
+ ' '
'F2: '
- ' '
+ ' '
'F3: '
'F4: '
@@ -3620,13 +3620,13 @@ Good luck picking a username that doesn't already exist.
f.as_p(),
''
'(Hidden field data) This field is required. \n '
- '
'
+ ' '
)
self.assertHTMLEqual(
f.as_table(),
''
'(Hidden field data) This field is required. '
- ' '
+ ' '
)
def test_field_named_data(self):
diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py
index 6e8ca01261e..7d061047918 100644
--- a/tests/forms_tests/tests/test_formsets.py
+++ b/tests/forms_tests/tests/test_formsets.py
@@ -87,12 +87,12 @@ class FormsFormsetTestCase(SimpleTestCase):
formset = self.make_choiceformset()
self.assertHTMLEqual(
str(formset),
- """
-
-
-
-Choice:
-Votes: """
+ """
+
+
+
+Choice:
+Votes: """
)
# FormSet are treated similarly to Forms. FormSet has an is_valid()
# method, and a cleaned_data or errors attribute depending on whether
@@ -199,10 +199,10 @@ class FormsFormsetTestCase(SimpleTestCase):
form_output.append(form.as_ul())
self.assertHTMLEqual(
'\n'.join(form_output),
- """Choice:
-Votes:
-Choice:
-Votes: """
+ """Choice:
+Votes:
+Choice:
+Votes: """
)
def test_blank_form_unfilled(self):
@@ -244,12 +244,12 @@ class FormsFormsetTestCase(SimpleTestCase):
form_output.append(form.as_ul())
self.assertHTMLEqual(
'\n'.join(form_output),
- """Choice:
-Votes:
-Choice:
-Votes:
-Choice:
-Votes: """
+ """Choice:
+Votes:
+Choice:
+Votes:
+Choice:
+Votes: """
)
# Since every form was displayed as blank, they are also accepted as
# blank. This may seem a little strange, but min_num is used to require
@@ -285,10 +285,10 @@ class FormsFormsetTestCase(SimpleTestCase):
self.assertTrue(formset.forms[1].empty_permitted)
self.assertHTMLEqual(
'\n'.join(form_output),
- """Choice:
-Votes:
-Choice:
-Votes: """
+ """Choice:
+Votes:
+Choice:
+Votes: """
)
def test_min_num_displaying_more_than_one_blank_form_with_zero_extra(self):
@@ -300,12 +300,12 @@ class FormsFormsetTestCase(SimpleTestCase):
form_output.append(form.as_ul())
self.assertHTMLEqual(
'\n'.join(form_output),
- """Choice:
-Votes:
-Choice:
-Votes:
-Choice:
-Votes: """
+ """Choice:
+Votes:
+Choice:
+Votes:
+Choice:
+Votes: """
)
def test_single_form_completed(self):
@@ -439,21 +439,21 @@ class FormsFormsetTestCase(SimpleTestCase):
form_output.append(form.as_ul())
self.assertHTMLEqual(
'\n'.join(form_output),
- """Choice:
-Votes:
-Choice:
-Votes:
-Choice:
-Votes:
-Choice:
-Votes: """
+ """Choice:
+Votes:
+Choice:
+Votes:
+Choice:
+Votes:
+Choice:
+Votes: """
)
# Retrieving an empty form works. Tt shows up in the form list.
self.assertTrue(formset.empty_form.empty_permitted)
self.assertHTMLEqual(
formset.empty_form.as_ul(),
- """Choice:
-Votes: """
+ """Choice:
+Votes: """
)
def test_formset_with_deletion(self):
@@ -470,15 +470,15 @@ class FormsFormsetTestCase(SimpleTestCase):
form_output.append(form.as_ul())
self.assertHTMLEqual(
'\n'.join(form_output),
- """Choice:
-Votes:
-Delete:
-Choice:
-Votes:
-Delete:
-Choice:
-Votes:
-Delete: """
+ """Choice:
+Votes:
+Delete:
+Choice:
+Votes:
+Delete:
+Choice:
+Votes:
+Delete: """
)
# To delete something, set that form's special delete field to 'on'.
# Let's go ahead and delete Fergie.
@@ -580,15 +580,15 @@ class FormsFormsetTestCase(SimpleTestCase):
form_output.append(form.as_ul())
self.assertHTMLEqual(
'\n'.join(form_output),
- """Choice:
-Votes:
-Order:
-Choice:
-Votes:
-Order:
-Choice:
-Votes:
-Order: """
+ """Choice:
+Votes:
+Order:
+Choice:
+Votes:
+Order:
+Choice:
+Votes:
+Order: """
)
data = {
'choices-TOTAL_FORMS': '3', # the number of forms rendered
@@ -684,22 +684,22 @@ class FormsFormsetTestCase(SimpleTestCase):
form_output.append(form.as_ul())
self.assertHTMLEqual(
'\n'.join(form_output),
- """Choice:
-Votes:
-Order:
-Delete:
-Choice:
-Votes:
-Order:
-Delete:
-Choice:
-Votes:
-Order:
-Delete:
-Choice:
-Votes:
-Order:
-Delete: """
+ """Choice:
+Votes:
+Order:
+Delete:
+Choice:
+Votes:
+Order:
+Delete:
+Choice:
+Votes:
+Order:
+Delete:
+Choice:
+Votes:
+Order:
+Delete: """
)
# Let's delete Fergie, and put The Decemberists ahead of Calexico.
data = {
@@ -803,11 +803,11 @@ class FormsFormsetTestCase(SimpleTestCase):
self.assertHTMLEqual(
'\n'.join(form_output),
"""Name:
-
+
Name:
-
+
Name:
- """
+ """
)
# If max_num is 0 then no form is rendered at all.
LimitedFavoriteDrinkFormSet = formset_factory(FavoriteDrinkForm, extra=3, max_num=0)
@@ -826,9 +826,9 @@ class FormsFormsetTestCase(SimpleTestCase):
self.assertHTMLEqual(
'\n'.join(form_output),
"""Name:
-
+
Name:
- """
+ """
)
def test_limiting_extra_lest_than_max_num(self):
@@ -841,7 +841,7 @@ class FormsFormsetTestCase(SimpleTestCase):
self.assertHTMLEqual(
'\n'.join(form_output),
"""Name:
- """
+ """
)
def test_max_num_with_initial_data(self):
@@ -860,9 +860,9 @@ class FormsFormsetTestCase(SimpleTestCase):
self.assertHTMLEqual(
'\n'.join(form_output),
"""Name:
-
+
Name:
- """
+ """
)
def test_max_num_zero(self):
@@ -891,9 +891,9 @@ class FormsFormsetTestCase(SimpleTestCase):
self.assertHTMLEqual(
'\n'.join(form_output),
"""Name:
-
+
Name:
- """
+ """
)
def test_more_initial_than_max_num(self):
@@ -914,11 +914,11 @@ class FormsFormsetTestCase(SimpleTestCase):
self.assertHTMLEqual(
'\n'.join(form_output),
"""Name:
-
+
Name:
-
+
Name:
- """
+ """
)
def test_more_initial_form_result_in_one(self):
@@ -937,9 +937,9 @@ class FormsFormsetTestCase(SimpleTestCase):
self.assertHTMLEqual(
'\n'.join(form_output),
"""Name:
-
+
Name:
- """
+ """
)
def test_management_form_prefix(self):
@@ -1195,36 +1195,36 @@ class FormsetAsFooTests(SimpleTestCase):
formset = ChoiceFormSet(data, auto_id=False, prefix='choices')
self.assertHTMLEqual(
formset.as_table(),
- """
-
-
-
-Choice:
-Votes: """
+ """
+
+
+
+Choice:
+Votes: """
)
def test_as_p(self):
formset = ChoiceFormSet(data, auto_id=False, prefix='choices')
self.assertHTMLEqual(
formset.as_p(),
- """
-
-
-
-Choice:
-Votes:
"""
+ """
+
+
+
+Choice:
+Votes:
"""
)
def test_as_ul(self):
formset = ChoiceFormSet(data, auto_id=False, prefix='choices')
self.assertHTMLEqual(
formset.as_ul(),
- """
-
-
-
-Choice:
-Votes: """
+ """
+
+
+
+Choice:
+Votes: """
)
diff --git a/tests/forms_tests/tests/test_i18n.py b/tests/forms_tests/tests/test_i18n.py
index 73d5b270eb3..be166514bf5 100644
--- a/tests/forms_tests/tests/test_i18n.py
+++ b/tests/forms_tests/tests/test_i18n.py
@@ -15,7 +15,7 @@ class FormsI18nTests(SimpleTestCase):
self.assertHTMLEqual(
f.as_p(),
'username: '
- '
'
+ ' '
)
# Translations are done at rendering time, so multi-lingual apps can define forms)
@@ -23,13 +23,13 @@ class FormsI18nTests(SimpleTestCase):
self.assertHTMLEqual(
f.as_p(),
'Benutzername: '
- '
'
+ ' '
)
with translation.override('pl'):
self.assertHTMLEqual(
f.as_p(),
'u\u017cytkownik: '
- '
'
+ ' '
)
def test_non_ascii_label(self):
@@ -59,12 +59,12 @@ class FormsI18nTests(SimpleTestCase):
'\xc5\xf8\xdf: '
'
'
)
@@ -78,12 +78,12 @@ class FormsI18nTests(SimpleTestCase):
'\u043d\u043e\u0435 \u043f\u043e\u043b\u0435. \n'
'\xc5\xf8\xdf: '
'
'
)
diff --git a/tests/forms_tests/tests/test_media.py b/tests/forms_tests/tests/test_media.py
index 2b73a041bec..9798fc027bc 100644
--- a/tests/forms_tests/tests/test_media.py
+++ b/tests/forms_tests/tests/test_media.py
@@ -19,8 +19,8 @@ class FormsMediaTestCase(SimpleTestCase):
)
self.assertEqual(
str(m),
- """
-
+ """
+
"""
@@ -40,8 +40,8 @@ class FormsMediaTestCase(SimpleTestCase):
m3 = Media(Foo)
self.assertEqual(
str(m3),
- """
-
+ """
+
"""
@@ -72,8 +72,8 @@ class FormsMediaTestCase(SimpleTestCase):
w1 = MyWidget1()
self.assertEqual(
str(w1.media),
- """
-
+ """
+
"""
@@ -82,8 +82,8 @@ class FormsMediaTestCase(SimpleTestCase):
# Media objects can be interrogated by media type
self.assertEqual(
str(w1.media['css']),
- """
- """
+ """
+ """
)
self.assertEqual(
@@ -122,9 +122,9 @@ class FormsMediaTestCase(SimpleTestCase):
w3 = MyWidget3()
self.assertEqual(
str(w1.media + w2.media + w3.media),
- """
-
-
+ """
+
+
@@ -134,8 +134,8 @@ class FormsMediaTestCase(SimpleTestCase):
# media addition hasn't affected the original objects
self.assertEqual(
str(w1.media),
- """
-
+ """
+
"""
@@ -150,7 +150,7 @@ class FormsMediaTestCase(SimpleTestCase):
js = ('/path/to/js1', '/path/to/js1')
w4 = MyWidget4()
- self.assertEqual(str(w4.media), """
+ self.assertEqual(str(w4.media), """
""")
def test_media_property(self):
@@ -165,7 +165,7 @@ class FormsMediaTestCase(SimpleTestCase):
media = property(_media)
w4 = MyWidget4()
- self.assertEqual(str(w4.media), """
+ self.assertEqual(str(w4.media), """
""")
# Media properties can reference the media of their parents
@@ -175,8 +175,8 @@ class FormsMediaTestCase(SimpleTestCase):
media = property(_media)
w5 = MyWidget5()
- self.assertEqual(str(w5.media), """
-
+ self.assertEqual(str(w5.media), """
+
""")
@@ -198,9 +198,9 @@ class FormsMediaTestCase(SimpleTestCase):
w6 = MyWidget6()
self.assertEqual(
str(w6.media),
- """
-
-
+ """
+
+
@@ -226,8 +226,8 @@ class FormsMediaTestCase(SimpleTestCase):
w7 = MyWidget7()
self.assertEqual(
str(w7.media),
- """
-
+ """
+
"""
@@ -244,9 +244,9 @@ class FormsMediaTestCase(SimpleTestCase):
w8 = MyWidget8()
self.assertEqual(
str(w8.media),
- """
-
-
+ """
+
+
@@ -278,8 +278,8 @@ class FormsMediaTestCase(SimpleTestCase):
w9 = MyWidget9()
self.assertEqual(
str(w9.media),
- """
-
+ """
+
"""
)
@@ -294,8 +294,8 @@ class FormsMediaTestCase(SimpleTestCase):
js = ('/path/to/js1', '/path/to/js4')
w10 = MyWidget10()
- self.assertEqual(str(w10.media), """
-
+ self.assertEqual(str(w10.media), """
+
""")
@@ -319,9 +319,9 @@ class FormsMediaTestCase(SimpleTestCase):
w11 = MyWidget11()
self.assertEqual(
str(w11.media),
- """
-
-
+ """
+
+
@@ -348,9 +348,9 @@ class FormsMediaTestCase(SimpleTestCase):
w12 = MyWidget12()
self.assertEqual(
str(w12.media),
- """
-
-
+ """
+
+
"""
)
@@ -373,10 +373,10 @@ class FormsMediaTestCase(SimpleTestCase):
multimedia = MultimediaWidget()
self.assertEqual(
str(multimedia.media),
- """
-
-
-
+ """
+
+
+
"""
)
@@ -417,9 +417,9 @@ class FormsMediaTestCase(SimpleTestCase):
mymulti = MyMultiWidget()
self.assertEqual(
str(mymulti.media),
- """
-
-
+ """
+
+
@@ -459,9 +459,9 @@ class FormsMediaTestCase(SimpleTestCase):
f1 = MyForm()
self.assertEqual(
str(f1.media),
- """
-
-
+ """
+
+
@@ -474,9 +474,9 @@ class FormsMediaTestCase(SimpleTestCase):
f2 = AnotherForm()
self.assertEqual(
str(f1.media + f2.media),
- """
-
-
+ """
+
+
@@ -496,10 +496,10 @@ class FormsMediaTestCase(SimpleTestCase):
f3 = FormWithMedia()
self.assertEqual(
str(f3.media),
- """
-
-
-
+ """
+
+
+
@@ -515,10 +515,10 @@ class FormsMediaTestCase(SimpleTestCase):
"""
- """
-
-
- """
+ """
+
+
+ """
)
def test_html_safe(self):
diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py
index bf0d588f53c..841a1c67997 100644
--- a/tests/forms_tests/tests/tests.py
+++ b/tests/forms_tests/tests/tests.py
@@ -109,24 +109,24 @@ class ModelFormCallableModelDefault(TestCase):
ChoiceOption 1
ChoiceOption 2
ChoiceOption 3
-
+
Choice int:
ChoiceOption 1
ChoiceOption 2
ChoiceOption 3
-
+
Multi choice:
ChoiceOption 1
ChoiceOption 2
ChoiceOption 3
-
+
Multi choice int:
ChoiceOption 1
ChoiceOption 2
ChoiceOption 3
-
"""
+ """
)
def test_initial_instance_value(self):
@@ -145,26 +145,26 @@ class ModelFormCallableModelDefault(TestCase):
ChoiceOption 1
ChoiceOption 2
ChoiceOption 3
-
+
Choice int:
ChoiceOption 1
ChoiceOption 2
ChoiceOption 3
-
+
Multi choice:
ChoiceOption 1
ChoiceOption 2
ChoiceOption 3
-
-
+
+
Multi choice int:
ChoiceOption 1
ChoiceOption 2
ChoiceOption 3
-
-
"""
+
+ """
)
@@ -308,7 +308,7 @@ class EmptyLabelTestCase(TestCase):
f = EmptyCharLabelChoiceForm()
self.assertHTMLEqual(
f.as_p(),
- """Name:
+ """Name:
Choice:
No Preference
Foo
@@ -320,7 +320,7 @@ class EmptyLabelTestCase(TestCase):
f = EmptyCharLabelNoneChoiceForm()
self.assertHTMLEqual(
f.as_p(),
- """Name:
+ """Name:
Choice string w none:
No Preference
@@ -350,7 +350,7 @@ class EmptyLabelTestCase(TestCase):
f = EmptyIntegerLabelChoiceForm()
self.assertHTMLEqual(
f.as_p(),
- """Name:
+ """Name:
Choice integer:
No Preference
@@ -370,7 +370,7 @@ class EmptyLabelTestCase(TestCase):
self.assertHTMLEqual(
f.as_p(),
"""Name:
-
+
Choice integer:
No Preference
@@ -384,7 +384,7 @@ class EmptyLabelTestCase(TestCase):
self.assertHTMLEqual(
f.as_p(),
"""Name:
-
+
Choice integer:
No Preference
diff --git a/tests/forms_tests/widget_tests/test_checkboxinput.py b/tests/forms_tests/widget_tests/test_checkboxinput.py
index 1ae6ab73b65..6483b7f2115 100644
--- a/tests/forms_tests/widget_tests/test_checkboxinput.py
+++ b/tests/forms_tests/widget_tests/test_checkboxinput.py
@@ -7,18 +7,18 @@ class CheckboxInputTest(WidgetTest):
widget = CheckboxInput()
def test_render_empty(self):
- self.check_html(self.widget, 'is_cool', '', html=' ')
+ self.check_html(self.widget, 'is_cool', '', html=' ')
def test_render_none(self):
- self.check_html(self.widget, 'is_cool', None, html=' ')
+ self.check_html(self.widget, 'is_cool', None, html=' ')
def test_render_false(self):
- self.check_html(self.widget, 'is_cool', False, html=' ')
+ self.check_html(self.widget, 'is_cool', False, html=' ')
def test_render_true(self):
self.check_html(
self.widget, 'is_cool', True,
- html=' '
+ html=' '
)
def test_render_value(self):
@@ -28,7 +28,7 @@ class CheckboxInputTest(WidgetTest):
"""
self.check_html(
self.widget, 'is_cool', 'foo',
- html=' ',
+ html=' ',
)
def test_render_int(self):
@@ -37,11 +37,11 @@ class CheckboxInputTest(WidgetTest):
"""
self.check_html(
self.widget, 'is_cool', 0,
- html=' ',
+ html=' ',
)
self.check_html(
self.widget, 'is_cool', 1,
- html=' ',
+ html=' ',
)
def test_render_check_test(self):
@@ -51,16 +51,16 @@ class CheckboxInputTest(WidgetTest):
"""
widget = CheckboxInput(check_test=lambda value: value.startswith('hello'))
self.check_html(widget, 'greeting', '', html=(
- ' '
+ ' '
))
self.check_html(widget, 'greeting', 'hello', html=(
- ' '
+ ' '
))
self.check_html(widget, 'greeting', 'hello there', html=(
- ' '
+ ' '
))
self.check_html(widget, 'greeting', 'hello & goodbye', html=(
- ' '
+ ' '
))
def test_render_check_exception(self):
diff --git a/tests/forms_tests/widget_tests/test_checkboxselectmultiple.py b/tests/forms_tests/widget_tests/test_checkboxselectmultiple.py
index 239f80da475..ef31ce9d366 100644
--- a/tests/forms_tests/widget_tests/test_checkboxselectmultiple.py
+++ b/tests/forms_tests/widget_tests/test_checkboxselectmultiple.py
@@ -13,20 +13,20 @@ class CheckboxSelectMultipleTest(WidgetTest):
def test_render_value(self):
self.check_html(self.widget(choices=self.beatles), 'beatles', ['J'], html=(
""""""
))
def test_render_value_multiple(self):
self.check_html(self.widget(choices=self.beatles), 'beatles', ['J', 'P'], html=(
""""""
))
@@ -36,10 +36,10 @@ class CheckboxSelectMultipleTest(WidgetTest):
"""
self.check_html(self.widget(choices=self.beatles), 'beatles', None, html=(
""""""
))
@@ -52,25 +52,25 @@ class CheckboxSelectMultipleTest(WidgetTest):
html = """
Delete:
+id="id_generic_relations-taggeditem-content_type-object_id-0-DELETE">
"""
+id="id_generic_relations-taggeditem-content_type-object_id-0-id">
"""
)
formset = GenericFormSet(instance=Animal())
self.assertHTMLEqual(
''.join(form.as_p() for form in formset.forms),
"""
Tag:
+type="text" name="generic_relations-taggeditem-content_type-object_id-0-tag" maxlength="50">
Delete:
"""
+id="id_generic_relations-taggeditem-content_type-object_id-0-id">"""
)
platypus = Animal.objects.create(
common_name='Platypus', latin_name='Ornithorhynchus anatinus',
@@ -60,29 +60,29 @@ id="id_generic_relations-taggeditem-content_type-object_id-0-id" />"""
''.join(form.as_p() for form in formset.forms),
"""Tag:
+name="generic_relations-taggeditem-content_type-object_id-0-tag" value="shiny" maxlength="50">
Delete:
+id="id_generic_relations-taggeditem-content_type-object_id-0-DELETE">
+value="%s" id="id_generic_relations-taggeditem-content_type-object_id-0-id">
Tag:
+name="generic_relations-taggeditem-content_type-object_id-1-tag" maxlength="50">
Delete:
+id="id_generic_relations-taggeditem-content_type-object_id-1-DELETE">
""" % tagged_item_id
+id="id_generic_relations-taggeditem-content_type-object_id-1-id">""" % tagged_item_id
)
lion = Animal.objects.create(common_name='Lion', latin_name='Panthera leo')
formset = GenericFormSet(instance=lion, prefix='x')
self.assertHTMLEqual(
''.join(form.as_p() for form in formset.forms),
"""Tag:
-
-Delete:
-
"""
+
+Delete:
+
"""
)
def test_options(self):
@@ -101,7 +101,7 @@ id="id_generic_relations-taggeditem-content_type-object_id-1-id" />""" % tag
self.assertHTMLEqual(
formset.forms[0].as_p(),
' ' % harmless.pk
+ 'id="id_generic_relations-taggeditem-content_type-object_id-0-id">' % harmless.pk
)
self.assertEqual(formset.forms[0].instance, harmless)
self.assertEqual(formset.forms[1].instance, mammal)
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index 5fb710faf8b..8eedf09d688 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -909,13 +909,13 @@ class FormattingTests(SimpleTestCase):
self.assertHTMLEqual(
form6.as_ul(),
'Name: '
- ' '
+ ' '
'Date added: '
- ' '
+ ' '
'Cents paid: '
- ' '
+ ' '
'Products delivered: '
- ' '
+ ' '
' '
)
self.assertEqual(localize_input(datetime.datetime(2009, 12, 31, 6, 0, 0)), '31.12.2009 06:00:00')
@@ -924,7 +924,7 @@ class FormattingTests(SimpleTestCase):
# Checking for the localized "products_delivered" field
self.assertInHTML(
' ',
+ 'value="12.000" id="id_products_delivered" required>',
form6.as_ul()
)
@@ -1073,18 +1073,18 @@ class FormattingTests(SimpleTestCase):
self.assertHTMLEqual(
template.render(context),
- ' ;'
- ' '
+ ' ;'
+ ' '
)
self.assertHTMLEqual(
template_as_text.render(context),
- ' ;'
- ' '
+ ' ;'
+ ' '
)
self.assertHTMLEqual(
template_as_hidden.render(context),
- ' ;'
- ' '
+ ' ;'
+ ' '
)
def test_format_arbitrary_settings(self):
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index b6ce55cf406..406a137d800 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -536,11 +536,11 @@ class ModelFormBaseTest(TestCase):
self.assertHTMLEqual(
str(SubclassMeta()),
"""Name:
-
+
Slug:
-
+
Checkbox:
- """
+ """
)
def test_orderfields_form(self):
@@ -554,9 +554,9 @@ class ModelFormBaseTest(TestCase):
self.assertHTMLEqual(
str(OrderFields()),
"""The URL:
-
+
Name:
- """
+ """
)
def test_orderfields2_form(self):
@@ -742,11 +742,11 @@ class TestFieldOverridesByFormMeta(SimpleTestCase):
)
self.assertHTMLEqual(
str(form['url']),
- ' ',
+ ' ',
)
self.assertHTMLEqual(
str(form['slug']),
- ' ',
+ ' ',
)
def test_label_overrides(self):
@@ -1123,29 +1123,29 @@ class ModelFormBasicTests(TestCase):
self.assertHTMLEqual(
str(f),
"""Name:
-
+
Slug:
-
+
The URL:
- """
+ """
)
self.assertHTMLEqual(
str(f.as_ul()),
- """Name:
-Slug:
-The URL: """
+ """Name:
+Slug:
+The URL: """
)
self.assertHTMLEqual(
str(f["name"]),
- """ """)
+ """ """)
def test_auto_id(self):
f = BaseCategoryForm(auto_id=False)
self.assertHTMLEqual(
str(f.as_ul()),
- """Name:
-Slug:
-The URL: """
+ """Name:
+Slug:
+The URL: """
)
def test_initial_values(self):
@@ -1159,9 +1159,9 @@ class ModelFormBasicTests(TestCase):
})
self.assertHTMLEqual(
f.as_ul(),
- '''Headline:
-Slug:
-Pub date:
+ '''Headline:
+Slug:
+Pub date:
Writer:
---------
Bob Woodward
@@ -1185,7 +1185,7 @@ class ModelFormBasicTests(TestCase):
f = RoykoForm(auto_id=False, instance=self.w_royko)
self.assertHTMLEqual(
str(f),
- '''Name:
+ '''Name:
Use both first and last names. '''
)
@@ -1201,9 +1201,9 @@ class ModelFormBasicTests(TestCase):
f = ArticleForm(auto_id=False, instance=art)
self.assertHTMLEqual(
f.as_ul(),
- '''Headline:
-Slug:
-Pub date:
+ '''Headline:
+Slug:
+Pub date:
Writer:
---------
Bob Woodward
@@ -1256,7 +1256,7 @@ class ModelFormBasicTests(TestCase):
self.assertHTMLEqual(
form.as_ul(),
"""Headline:
-
+
Categories:
Entertainment
@@ -1318,9 +1318,9 @@ class ModelFormBasicTests(TestCase):
f = ArticleForm(auto_id=False)
self.assertHTMLEqual(
str(f),
- '''Headline:
-Slug:
-Pub date:
+ '''Headline:
+Slug:
+Pub date:
Writer:
---------
Bob Woodward
@@ -1348,9 +1348,9 @@ class ModelFormBasicTests(TestCase):
f = ArticleForm(auto_id=False, instance=new_art)
self.assertHTMLEqual(
f.as_ul(),
- '''Headline:
-Slug:
-Pub date:
+ '''Headline:
+Slug:
+Pub date:
Writer:
---------
Bob Woodward
@@ -1384,8 +1384,8 @@ class ModelFormBasicTests(TestCase):
f = PartialArticleForm(auto_id=False)
self.assertHTMLEqual(
str(f),
- '''Headline:
-Pub date: ''')
+ '''Headline:
+Pub date: ''')
class PartialArticleFormWithSlug(forms.ModelForm):
class Meta:
@@ -1403,9 +1403,9 @@ class ModelFormBasicTests(TestCase):
}, auto_id=False, instance=art)
self.assertHTMLEqual(
f.as_ul(),
- '''Headline:
-Slug:
-Pub date: '''
+ '''Headline:
+Slug:
+Pub date: '''
)
self.assertTrue(f.is_valid())
new_art = f.save()
@@ -1492,9 +1492,9 @@ class ModelFormBasicTests(TestCase):
f = ArticleForm(auto_id=False)
self.assertHTMLEqual(
f.as_ul(),
- '''Headline:
-Slug:
-Pub date:
+ '''Headline:
+Slug:
+Pub date:
Writer:
---------
Bob Woodward
@@ -1517,9 +1517,9 @@ class ModelFormBasicTests(TestCase):
w_bernstein = Writer.objects.create(name='Carl Bernstein')
self.assertHTMLEqual(
f.as_ul(),
- '''Headline:
-Slug:
-Pub date:
+ '''Headline:
+Slug:
+Pub date:
Writer:
---------
Bob Woodward
@@ -1786,9 +1786,9 @@ class ModelChoiceFieldTests(TestCase):
self.assertHTMLEqual(
field.widget.render('name', []),
'''''' % (self.c1.pk, self.c2.pk, self.c3.pk),
)
@@ -2059,7 +2059,7 @@ class ModelOneToOneFieldTests(TestCase):
Bob Woodward
Mike Royko
-Age:
''' % (
+Age:
''' % (
self.w_woodward.pk, self.w_royko.pk,
)
)
@@ -2081,7 +2081,7 @@ class ModelOneToOneFieldTests(TestCase):
Mike Royko
Age:
-
''' % (
+ ''' % (
self.w_woodward.pk, self.w_royko.pk,
)
)
@@ -2194,7 +2194,7 @@ class FileAndImageFieldTests(TestCase):
form = DocumentForm(instance=doc)
self.assertHTMLEqual(
str(form['myfile']),
- ' '
+ ' '
)
def test_file_field_data(self):
@@ -2569,7 +2569,7 @@ class OtherModelFormTests(TestCase):
f = ModelFormWithMedia()
self.assertHTMLEqual(
str(f.media),
- '''
+ '''
'''
)
@@ -2644,9 +2644,9 @@ class OtherModelFormTests(TestCase):
self.assertHTMLEqual(
str(CategoryForm()),
'''Description:
-
+
The URL:
- '''
+ '''
)
# to_field_name should also work on ModelMultipleChoiceField ##################
@@ -2665,7 +2665,7 @@ class OtherModelFormTests(TestCase):
self.assertHTMLEqual(
str(CustomFieldForExclusionForm()),
'''Name:
- '''
+ '''
)
def test_iterable_model_m2m(self):
@@ -2679,7 +2679,7 @@ class OtherModelFormTests(TestCase):
self.maxDiff = 1024
self.assertHTMLEqual(
form.as_p(),
- """Name:
+ """Name:
Colours:
Blue
@@ -2699,19 +2699,19 @@ class OtherModelFormTests(TestCase):
form.as_p(),
"""
Title:
-
+
Date published:
-
-
+
+
Mode:
direct
delayed
-
+
Category:
Games
Comics
Novel
-
+
""".format(today_str)
)
empty_data = {
diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py
index 92d607f7c34..4d00a589ce9 100644
--- a/tests/model_formsets/tests.py
+++ b/tests/model_formsets/tests.py
@@ -152,20 +152,20 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'
Name: '
- ' '
- '
'
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Name: '
- ' '
- '
'
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[2].as_p(),
'Name: '
- ' '
- '
'
+ ' '
+ ' '
)
data = {
@@ -202,20 +202,20 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Name: '
- ' '
- '
' % author2.id
+ ' '
+ ' ' % author2.id
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Name: '
- ' '
- '
' % author1.id
+ ' '
+ ' ' % author1.id
)
self.assertHTMLEqual(
formset.forms[2].as_p(),
'Name: '
- ' '
- '
'
+ ' '
+ ' '
)
data = {
@@ -253,36 +253,36 @@ class ModelFormsetTest(TestCase):
formset.forms[0].as_p(),
'Name: '
'
'
+ 'value="Arthur Rimbaud" maxlength="100">'
'Delete: '
- ' '
- '
' % author2.id
+ ' '
+ ' ' % author2.id
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Name: '
'
'
+ 'value="Charles Baudelaire" maxlength="100">'
'Delete: '
- ' '
- '
' % author1.id
+ ' '
+ ' ' % author1.id
)
self.assertHTMLEqual(
formset.forms[2].as_p(),
'Name: '
'
'
+ 'value="Paul Verlaine" maxlength="100">'
'Delete: '
- ' '
- '
' % author3.id
+ ' '
+ ' ' % author3.id
)
self.assertHTMLEqual(
formset.forms[3].as_p(),
'Name: '
- '
'
+ ' '
'Delete: '
- ' '
- '
'
+ ' '
+ ' '
)
data = {
@@ -528,10 +528,10 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Name: '
- '
'
+ ' '
'Write speed: '
- ' '
- '
'
+ ' '
+ ' '
)
data = {
@@ -556,18 +556,18 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Name: '
- '
'
+ ' '
'Write speed: '
- ' '
- '
' % hemingway_id
+ ' '
+ ' ' % hemingway_id
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Name: '
- '
'
+ ' '
'Write speed: '
- ' '
- '
'
+ ' '
+ ' '
)
data = {
@@ -598,23 +598,23 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Title: '
+ 'name="book_set-0-title" maxlength="100"> '
'
' % author.id
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Title: '
- ' '
- ' '
- '
' % author.id
+ ' '
+ ' '
+ ' ' % author.id
)
self.assertHTMLEqual(
formset.forms[2].as_p(),
'Title: '
- ' '
- ' '
- '
' % author.id
+ ' '
+ ' '
+ ' ' % author.id
)
data = {
@@ -648,25 +648,25 @@ class ModelFormsetTest(TestCase):
formset.forms[0].as_p(),
'Title: '
' '
- ' '
- '
' % (
+ 'value="Les Fleurs du Mal" maxlength="100">'
+ ' '
+ ' ' % (
author.id, book1.id,
)
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Title: '
- ' '
- ' '
- '
' % author.id
+ ' '
+ ' '
+ ' ' % author.id
)
self.assertHTMLEqual(
formset.forms[2].as_p(),
'Title: '
- ' '
- ' '
- '
' % author.id
+ ' '
+ ' '
+ ' ' % author.id
)
data = {
@@ -733,17 +733,17 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Title: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Title: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
def test_inline_formsets_with_custom_pk(self):
@@ -762,12 +762,12 @@ class ModelFormsetTest(TestCase):
formset.forms[0].as_p(),
'My pk: '
'
'
+ 'name="bookwithcustompk_set-0-my_pk" step="1">'
'Title: '
' '
+ 'name="bookwithcustompk_set-0-title" maxlength="100">'
'
'
+ 'value="1" id="id_bookwithcustompk_set-0-author">'
)
data = {
@@ -802,14 +802,14 @@ class ModelFormsetTest(TestCase):
formset.forms[0].as_p(),
'Title: '
'
'
+ 'name="alternatebook_set-0-title" maxlength="100">'
'Notes: '
' '
+ 'name="alternatebook_set-0-notes" maxlength="100">'
' '
+ 'id="id_alternatebook_set-0-author">'
'
'
+ 'id="id_alternatebook_set-0-book_ptr">'
)
data = {
@@ -905,39 +905,39 @@ class ModelFormsetTest(TestCase):
formset.forms[0].as_p(),
'Title: '
' '
- ' '
- '
'
+ 'value="Les Paradis Artificiels" maxlength="100">'
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Title: '
' '
- ' '
- '
'
+ 'value="Les Fleurs du Mal" maxlength="100">'
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[2].as_p(),
'Title: '
' '
- ' '
- '
'
+ 'value="Flowers of Evil" maxlength="100">'
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[3].as_p(),
'Title: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[4].as_p(),
'Title: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
data = {
@@ -962,23 +962,23 @@ class ModelFormsetTest(TestCase):
formset.forms[0].as_p(),
'Title: '
' '
- ' '
- '
'
+ 'value="Flowers of Evil" maxlength="100">'
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Title: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[2].as_p(),
'Title: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
data = {
@@ -1040,9 +1040,9 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'My pk:
'
+ 'name="form-0-my_pk" maxlength="10">'
'Some field: '
- '
'
+ ' '
)
# Custom primary keys with ForeignKey, OneToOneField and AutoField ############
@@ -1055,16 +1055,16 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Name: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Name: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
data = {
@@ -1089,24 +1089,24 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Name: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
% owner1.auto_id
)
self.assertHTMLEqual(
formset.forms[1].as_p(),
'Name: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
self.assertHTMLEqual(
formset.forms[2].as_p(),
'Name: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
data = {
@@ -1141,7 +1141,7 @@ class ModelFormsetTest(TestCase):
'Jack Berry at Giordanos '
' '
'Age: '
- '
'
+ ' '
% (owner1.auto_id, owner2.auto_id)
)
@@ -1154,8 +1154,8 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Age: '
- ' '
- '
'
+ ' '
+ ' '
% owner1.auto_id
)
@@ -1179,8 +1179,8 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Age: '
- ' '
- '
'
+ ' '
+ ' '
% owner1.auto_id
)
@@ -1212,11 +1212,11 @@ class ModelFormsetTest(TestCase):
self.assertHTMLEqual(
formset.forms[0].as_p(),
'Lat: '
- '
'
+ ' '
'Lon: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
)
def test_foreign_keys_in_parents(self):
@@ -1372,13 +1372,13 @@ class ModelFormsetTest(TestCase):
result,
'Date joined: '
' '
+ 'value="__DATETIME__" id="id_membership_set-0-date_joined">'
'
'
+ 'id="initial-membership_set-0-id_membership_set-0-date_joined">'
'Karma: '
- ' '
- ' '
- '
'
+ ' '
+ ' '
+ ' '
% person.id)
# test for validation with callable defaults. Validations rely on hidden fields
@@ -1724,7 +1724,7 @@ class TestModelFormsetOverridesTroughFormMeta(TestCase):
form = PoetFormSet.form()
self.assertHTMLEqual(
"%s" % form['name'],
- ' '
+ ' '
)
def test_inlineformset_factory_widgets(self):
@@ -1735,7 +1735,7 @@ class TestModelFormsetOverridesTroughFormMeta(TestCase):
form = BookFormSet.form()
self.assertHTMLEqual(
"%s" % form['title'],
- ' '
+ ' '
)
def test_modelformset_factory_labels_overrides(self):
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index e2ad3e8dcc4..4776bda934a 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -805,9 +805,9 @@ class TestSplitFormField(PostgreSQLTestCase):
Array:
-
-
-
+
+
+
''')
@@ -876,8 +876,8 @@ class TestSplitFormWidget(PostgreSQLWidgetTestCase):
self.check_html(
SplitArrayWidget(forms.TextInput(), size=2), 'array', None,
"""
-
-
+
+
"""
)
@@ -887,8 +887,8 @@ class TestSplitFormWidget(PostgreSQLWidgetTestCase):
'array', ['val1', 'val2'], attrs={'id': 'foo'},
html=(
"""
-
-
+
+
"""
)
)
diff --git a/tests/postgres_tests/test_ranges.py b/tests/postgres_tests/test_ranges.py
index 923e43b0ea4..6aa6c889dd7 100644
--- a/tests/postgres_tests/test_ranges.py
+++ b/tests/postgres_tests/test_ranges.py
@@ -468,10 +468,10 @@ class TestFormField(PostgreSQLTestCase):
Field:
-
-
-
-
+
+
+
+
''')
@@ -499,8 +499,8 @@ class TestFormField(PostgreSQLTestCase):
Ints:
-
-
+
+
''')
@@ -700,11 +700,11 @@ class TestWidget(PostgreSQLTestCase):
f = pg_forms.ranges.DateTimeRangeField()
self.assertHTMLEqual(
f.widget.render('datetimerange', ''),
- ' '
+ ' '
)
self.assertHTMLEqual(
f.widget.render('datetimerange', None),
- ' '
+ ' '
)
dt_range = DateTimeTZRange(
datetime.datetime(2006, 1, 10, 7, 30),
@@ -712,6 +712,6 @@ class TestWidget(PostgreSQLTestCase):
)
self.assertHTMLEqual(
f.widget.render('datetimerange', dt_range),
- ' '
- ' '
+ ' '
+ ' '
)
diff --git a/tests/staticfiles_tests/test_forms.py b/tests/staticfiles_tests/test_forms.py
index ec9f069ed8f..c5dc66de61b 100644
--- a/tests/staticfiles_tests/test_forms.py
+++ b/tests/staticfiles_tests/test_forms.py
@@ -29,8 +29,8 @@ class StaticFilesFormsMediaTestCase(SimpleTestCase):
)
self.assertEqual(
str(m),
- """
-
+ """
+
diff --git a/tests/template_backends/test_dummy.py b/tests/template_backends/test_dummy.py
index 92861c24dae..24c30c97e3b 100644
--- a/tests/template_backends/test_dummy.py
+++ b/tests/template_backends/test_dummy.py
@@ -81,7 +81,7 @@ class TemplateStringsTests(SimpleTestCase):
template = self.engine.get_template('template_backends/csrf.html')
content = template.render(request=request)
- expected = ' '
+ expected = ' '
match = re.match(expected, content) or re.match(expected.replace('"', "'"), content)
self.assertTrue(match, "hidden csrftoken field not found in output")
self.assertTrue(equivalent_tokens(match.group(1), get_token(request)))
diff --git a/tests/template_tests/filter_tests/test_linebreaks.py b/tests/template_tests/filter_tests/test_linebreaks.py
index 0f3cd7a1177..8fdb91f3773 100644
--- a/tests/template_tests/filter_tests/test_linebreaks.py
+++ b/tests/template_tests/filter_tests/test_linebreaks.py
@@ -15,12 +15,12 @@ class LinebreaksTests(SimpleTestCase):
@setup({'linebreaks01': '{{ a|linebreaks }} {{ b|linebreaks }}'})
def test_linebreaks01(self):
output = self.engine.render_to_string('linebreaks01', {"a": "x&\ny", "b": mark_safe("x&\ny")})
- self.assertEqual(output, "x& y
x& y
")
+ self.assertEqual(output, "x& y
x& y
")
@setup({'linebreaks02': '{% autoescape off %}{{ a|linebreaks }} {{ b|linebreaks }}{% endautoescape %}'})
def test_linebreaks02(self):
output = self.engine.render_to_string('linebreaks02', {"a": "x&\ny", "b": mark_safe("x&\ny")})
- self.assertEqual(output, "x& y
x& y
")
+ self.assertEqual(output, "x& y
x& y
")
class FunctionTests(SimpleTestCase):
@@ -29,13 +29,13 @@ class FunctionTests(SimpleTestCase):
self.assertEqual(linebreaks_filter('line 1'), 'line 1
')
def test_newline(self):
- self.assertEqual(linebreaks_filter('line 1\nline 2'), 'line 1 line 2
')
+ self.assertEqual(linebreaks_filter('line 1\nline 2'), 'line 1 line 2
')
def test_carriage(self):
- self.assertEqual(linebreaks_filter('line 1\rline 2'), 'line 1 line 2
')
+ self.assertEqual(linebreaks_filter('line 1\rline 2'), 'line 1 line 2
')
def test_carriage_newline(self):
- self.assertEqual(linebreaks_filter('line 1\r\nline 2'), 'line 1 line 2
')
+ self.assertEqual(linebreaks_filter('line 1\r\nline 2'), 'line 1 line 2
')
def test_non_string_input(self):
self.assertEqual(linebreaks_filter(123), '123
')
@@ -43,18 +43,18 @@ class FunctionTests(SimpleTestCase):
def test_autoescape(self):
self.assertEqual(
linebreaks_filter('foo\nbar \nbuz'),
- 'foo <a>bar</a> buz
',
+ 'foo <a>bar</a> buz
',
)
def test_autoescape_off(self):
self.assertEqual(
linebreaks_filter('foo\nbar \nbuz', autoescape=False),
- 'foobar buz
',
+ 'foobar buz
',
)
def test_lazy_string_input(self):
add_header = lazy(lambda string: 'Header\n\n' + string, str)
self.assertEqual(
linebreaks_filter(add_header('line 1\r\nline2')),
- 'Header
\n\nline 1 line2
'
+ 'Header
\n\nline 1 line2
'
)
diff --git a/tests/template_tests/filter_tests/test_linebreaksbr.py b/tests/template_tests/filter_tests/test_linebreaksbr.py
index 83a15f97db7..f2583f0aafe 100644
--- a/tests/template_tests/filter_tests/test_linebreaksbr.py
+++ b/tests/template_tests/filter_tests/test_linebreaksbr.py
@@ -14,24 +14,24 @@ class LinebreaksbrTests(SimpleTestCase):
@setup({'linebreaksbr01': '{{ a|linebreaksbr }} {{ b|linebreaksbr }}'})
def test_linebreaksbr01(self):
output = self.engine.render_to_string('linebreaksbr01', {"a": "x&\ny", "b": mark_safe("x&\ny")})
- self.assertEqual(output, "x& y x& y")
+ self.assertEqual(output, "x& y x& y")
@setup({'linebreaksbr02': '{% autoescape off %}{{ a|linebreaksbr }} {{ b|linebreaksbr }}{% endautoescape %}'})
def test_linebreaksbr02(self):
output = self.engine.render_to_string('linebreaksbr02', {"a": "x&\ny", "b": mark_safe("x&\ny")})
- self.assertEqual(output, "x& y x& y")
+ self.assertEqual(output, "x& y x& y")
class FunctionTests(SimpleTestCase):
def test_newline(self):
- self.assertEqual(linebreaksbr('line 1\nline 2'), 'line 1 line 2')
+ self.assertEqual(linebreaksbr('line 1\nline 2'), 'line 1 line 2')
def test_carriage(self):
- self.assertEqual(linebreaksbr('line 1\rline 2'), 'line 1 line 2')
+ self.assertEqual(linebreaksbr('line 1\rline 2'), 'line 1 line 2')
def test_carriage_newline(self):
- self.assertEqual(linebreaksbr('line 1\r\nline 2'), 'line 1 line 2')
+ self.assertEqual(linebreaksbr('line 1\r\nline 2'), 'line 1 line 2')
def test_non_string_input(self):
self.assertEqual(linebreaksbr(123), '123')
@@ -39,11 +39,11 @@ class FunctionTests(SimpleTestCase):
def test_autoescape(self):
self.assertEqual(
linebreaksbr('foo\nbar \nbuz'),
- 'foo <a>bar</a> buz',
+ 'foo <a>bar</a> buz',
)
def test_autoescape_off(self):
self.assertEqual(
linebreaksbr('foo\nbar \nbuz', autoescape=False),
- 'foobar buz',
+ 'foobar buz',
)
diff --git a/tests/templates/login.html b/tests/templates/login.html
index d1aa5f6b7cd..d9909aea60a 100644
--- a/tests/templates/login.html
+++ b/tests/templates/login.html
@@ -11,7 +11,7 @@
Password: {{ form.password }}
-
-
+
+
{% endblock %}
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index 08b31bc55a8..e6d1fe9a597 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -57,8 +57,8 @@ class TestUtilsHtml(SimpleTestCase):
def test_linebreaks(self):
items = (
("para1\n\npara2\r\rpara3", "para1
\n\npara2
\n\npara3
"),
- ("para1\nsub1\rsub2\n\npara2", "para1 sub1 sub2
\n\npara2
"),
- ("para1\r\n\r\npara2\rsub1\r\rpara4", "para1
\n\npara2 sub1
\n\npara4
"),
+ ("para1\nsub1\rsub2\n\npara2", "para1 sub1 sub2
\n\npara2
"),
+ ("para1\r\n\r\npara2\rsub1\r\rpara4", "para1
\n\npara2 sub1
\n\npara4
"),
("para1\tmore\n\npara2", "para1\tmore
\n\npara2
"),
)
for value, output in items: