summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-03-03 23:25:49 +0100
committerClaude Paroz <claude@2xlibre.net>2013-03-04 17:03:48 +0100
commit51cc7029b96d028989e92a185a2f88b89283d287 (patch)
treef6966b1c3f5b1c7ab1ed74d189517a1211ea078d /django/forms
parent03e40140ff3d9506aed1d69cd0e7f764e1c8bce9 (diff)
Fixed #19464 -- Eased customization of ClearableFileInput's link markup
Thanks rubyruy for the report and the patch.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/widgets.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 026e8dc36a..ba6f9c5b9a 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -331,6 +331,8 @@ class ClearableFileInput(FileInput):
template_with_clear = '%(clear)s <label for="%(clear_checkbox_id)s">%(clear_checkbox_label)s</label>'
+ url_markup_template = '<a href="{0}">{1}</a>'
+
def clear_checkbox_name(self, name):
"""
Given the name of the file input, return the name of the clear checkbox
@@ -356,7 +358,7 @@ class ClearableFileInput(FileInput):
if value and hasattr(value, "url"):
template = self.template_with_initial
- substitutions['initial'] = format_html('<a href="{0}">{1}</a>',
+ substitutions['initial'] = format_html(self.url_markup_template,
value.url,
force_text(value))
if not self.is_required: