Ticket #19464: url_markup_template.diff

File url_markup_template.diff, 1.0 KB (added by Ruy Asan, 12 years ago)
  • django/forms/widgets.py

    diff --git a/django/forms/widgets.py b/django/forms/widgets.py
    index c761ea8..19a7b65 100644
    a b class ClearableFileInput(FileInput):  
    340340    template_with_initial = '%(initial_text)s: %(initial)s %(clear_template)s<br />%(input_text)s: %(input)s'
    341341
    342342    template_with_clear = '%(clear)s <label for="%(clear_checkbox_id)s">%(clear_checkbox_label)s</label>'
     343
     344    url_markup_template = '<a href="{0}">{1}</a>'
    343345
    344346    def clear_checkbox_name(self, name):
    345347        """
    def render(self, name, value, attrs=None):  
    366368
    367369        if value and hasattr(value, "url"):
    368370            template = self.template_with_initial
    369             substitutions['initial'] = format_html('<a href="{0}">{1}</a>',
     371            substitutions['initial'] = format_html(self.url_markup_template,
    370372                                                   value.url,
    371373                                                   force_text(value))
    372374            if not self.is_required:
Back to Top