',
((force_text(w),) for w in self)))
@@ -325,7 +325,7 @@ class AdminURLFieldWidget(forms.URLInput):
value = force_text(self._format_value(value))
final_attrs = {'href': smart_urlquote(value)}
html = format_html(
- '
", flatatt(final_attrs), summary)
class ReadOnlyPasswordHashField(forms.Field):
diff --git a/django/contrib/gis/maps/google/gmap.py b/django/contrib/gis/maps/google/gmap.py
index 82e1eeeb24..4694996283 100644
--- a/django/contrib/gis/maps/google/gmap.py
+++ b/django/contrib/gis/maps/google/gmap.py
@@ -121,17 +121,17 @@ class GoogleMap(object):
@property
def body(self):
"Returns HTML body tag for loading and unloading Google Maps javascript."
- return format_html('', self.onload, self.onunload)
+ return format_html('', self.onload, self.onunload)
@property
def onload(self):
"Returns the `onload` HTML attribute."
- return format_html('onload="{0}.{1}_load()"', self.js_module, self.dom_id)
+ return format_html('onload="{}.{}_load()"', self.js_module, self.dom_id)
@property
def api_script(self):
"Returns the ',
+ return format_html('',
self.api_url, self.key)
@property
@@ -142,18 +142,18 @@ class GoogleMap(object):
@property
def scripts(self):
"Returns all tags required with Google Maps JavaScript."
- return format_html('{0}\n ',
+ return format_html('{}\n ',
self.api_script, mark_safe(self.js))
@property
def style(self):
"Returns additional CSS styling needed for Google Maps on IE."
- return format_html('', self.vml_css)
+ return format_html('', self.vml_css)
@property
def xhtml(self):
"Returns XHTML information needed for IE VML overlays."
- return format_html('', self.xmlns)
+ return format_html('', self.xmlns)
@property
def icons(self):
diff --git a/django/contrib/sessions/tests.py b/django/contrib/sessions/tests.py
index fe74c3f255..6679899a34 100644
--- a/django/contrib/sessions/tests.py
+++ b/django/contrib/sessions/tests.py
@@ -601,7 +601,7 @@ class SessionMiddlewareTests(unittest.TestCase):
# A deleted cookie header looks like:
# Set-Cookie: sessionid=; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
self.assertEqual(
- 'Set-Cookie: {0}=; expires=Thu, 01-Jan-1970 00:00:00 GMT; '
+ 'Set-Cookie: {}=; expires=Thu, 01-Jan-1970 00:00:00 GMT; '
'Max-Age=0; Path=/'.format(settings.SESSION_COOKIE_NAME),
str(response.cookies[settings.SESSION_COOKIE_NAME])
)
diff --git a/django/forms/forms.py b/django/forms/forms.py
index 3f6a876832..e68542e12a 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
@@ -645,7 +645,7 @@ class BoundField(object):
# Translators: If found as last label character, these punctuation
# characters will prevent the default label_suffix to be appended to the label
if label_suffix and contents and contents[-1] not in _(':?.!'):
- contents = format_html('{0}{1}', contents, label_suffix)
+ contents = format_html('{}{}', contents, label_suffix)
widget = self.field.widget
id_ = widget.attrs.get('id') or self.auto_id
if id_:
@@ -659,7 +659,7 @@ class BoundField(object):
else:
attrs['class'] = self.form.required_css_class
attrs = flatatt(attrs) if attrs else ''
- contents = format_html('', attrs, contents)
+ contents = format_html('', attrs, contents)
else:
contents = conditional_escape(contents)
return mark_safe(contents)
diff --git a/django/forms/utils.py b/django/forms/utils.py
index 7d4cd90b57..19c27f9b8c 100644
--- a/django/forms/utils.py
+++ b/django/forms/utils.py
@@ -39,8 +39,8 @@ def flatatt(attrs):
key_value_attrs.append((attr, value))
return (
- format_html_join('', ' {0}="{1}"', sorted(key_value_attrs)) +
- format_html_join('', ' {0}', sorted(boolean_attrs))
+ format_html_join('', ' {}="{}"', sorted(key_value_attrs)) +
+ format_html_join('', ' {}', sorted(boolean_attrs))
)
@@ -61,8 +61,8 @@ class ErrorDict(dict):
if not self:
return ''
return format_html(
- '
{0}
',
- format_html_join('', '
{0}{1}
', ((k, force_text(v)) for k, v in self.items()))
+ '
{}
',
+ format_html_join('', '
{}{}
', ((k, force_text(v)) for k, v in self.items()))
)
def as_text(self):
@@ -110,9 +110,9 @@ class ErrorList(UserList, list):
return ''
return format_html(
- '
{1}
',
+ '
{}
',
self.error_class,
- format_html_join('', '
{0}
', ((force_text(e),) for e in self))
+ format_html_join('', '
{}
', ((force_text(e),) for e in self))
)
def as_text(self):
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 7e3c8f3dca..de75b35932 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -53,7 +53,7 @@ class Media(object):
def render_js(self):
return [
format_html(
- '',
+ '',
self.absolute_path(path)
) for path in self._js
]
@@ -64,7 +64,7 @@ class Media(object):
media = sorted(self._css.keys())
return chain(*[[
format_html(
- '',
+ '',
self.absolute_path(path), medium
) for path in self._css[medium]
] for medium in media])
@@ -252,7 +252,7 @@ class Input(Widget):
if value != '':
# Only add the 'value' attribute if a value is non-empty.
final_attrs['value'] = force_text(self._format_value(value))
- return format_html('', flatatt(final_attrs))
+ return format_html('', flatatt(final_attrs))
class TextInput(Input):
@@ -315,7 +315,7 @@ class MultipleHiddenInput(HiddenInput):
# An ID attribute was given. Add a numeric index as a suffix
# so that the inputs don't all have the same ID attribute.
input_attrs['id'] = '%s_%s' % (id_, i)
- inputs.append(format_html('', flatatt(input_attrs)))
+ inputs.append(format_html('', flatatt(input_attrs)))
return mark_safe('\n'.join(inputs))
def value_from_datadict(self, data, files, name):
@@ -429,7 +429,7 @@ class Textarea(Widget):
if value is None:
value = ''
final_attrs = self.build_attrs(attrs, name=name)
- return format_html('',
+ return format_html('',
flatatt(final_attrs),
force_text(value))
@@ -478,7 +478,7 @@ class CheckboxInput(Widget):
if not (value is True or value is False or value is None or value == ''):
# Only add the 'value' attribute if a value is non-empty.
final_attrs['value'] = force_text(value)
- return format_html('', flatatt(final_attrs))
+ return format_html('', flatatt(final_attrs))
def value_from_datadict(self, data, files, name):
if name not in data:
@@ -507,7 +507,7 @@ class Select(Widget):
if value is None:
value = ''
final_attrs = self.build_attrs(attrs, name=name)
- output = [format_html('