Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #19464 -- Eased customization of ClearableFileInput's link markup

Thanks rubyruy for the report and the patch.
  • Loading branch information...
commit 51cc7029b96d028989e92a185a2f88b89283d287 1 parent 03e4014
@claudep claudep authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/forms/widgets.py
View
4 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 @@ def render(self, name, value, attrs=None):
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:
Please sign in to comment.
Something went wrong with that request. Please try again.