From 51cc7029b96d028989e92a185a2f88b89283d287 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sun, 3 Mar 2013 23:25:49 +0100 Subject: [PATCH] Fixed #19464 -- Eased customization of ClearableFileInput's link markup Thanks rubyruy for the report and the patch. --- django/forms/widgets.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 ' + url_markup_template = '{1}' + 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('{1}', + substitutions['initial'] = format_html(self.url_markup_template, value.url, force_text(value)) if not self.is_required: