Ticket #4593: unicode.newforms.b.patch

File unicode.newforms.b.patch, 851 bytes (added by Bjorn Swift <bjorn.swift@…>, 8 years ago)

Encode label in label_tag using smart_unicode

  • forms.py

     
    66
    77from django.utils.datastructures import SortedDict
    88from django.utils.html import escape
    9 from django.utils.encoding import StrAndUnicode
     9from django.utils.encoding import StrAndUnicode, smart_unicode
    1010
    1111from fields import Field
    1212from widgets import TextInput, Textarea
     
    300300        id_ = widget.attrs.get('id') or self.auto_id
    301301        if id_:
    302302            attrs = attrs and flatatt(attrs) or ''
    303             contents = '<label for="%s"%s>%s</label>' % (widget.id_for_label(id_), attrs, contents)
     303            contents = '<label for="%s"%s>%s</label>' % (widget.id_for_label(id_), attrs, smart_unicode(contents))
    304304        return contents
    305305
    306306    def _is_hidden(self):
Back to Top