Ticket #3947: newforms-unicode.diff
File newforms-unicode.diff, 1.9 KB (added by , 18 years ago) |
---|
-
django/newforms/forms.py
4 4 5 5 from django.utils.datastructures import SortedDict, MultiValueDict 6 6 from django.utils.html import escape 7 from django.utils.encoding import StrAndUnicode 7 from django.utils.encoding import StrAndUnicode, smart_unicode 8 8 from fields import Field 9 9 from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput 10 10 from util import flatatt, ErrorDict, ErrorList, ValidationError … … 127 127 help_text = help_text_html % field.help_text 128 128 else: 129 129 help_text = u'' 130 output.append(normal_row % {'errors': bf_errors, 'label': label, 'field': unicode(bf), 'help_text': help_text})130 output.append(normal_row % {'errors': bf_errors, 'label': smart_unicode(label), 'field': unicode(bf), 'help_text': help_text}) 131 131 if top_errors: 132 132 output.insert(0, error_row % top_errors) 133 133 if hidden_fields: # Insert any hidden fields in the last row. -
django/newforms/widgets.py
162 162 for option_value, option_label in chain(self.choices, choices): 163 163 option_value = smart_unicode(option_value) 164 164 selected_html = (option_value == str_value) and u' selected="selected"' or '' 165 output.append(u'<option value="%s"%s>%s</option>' % (escape(option_value), selected_html, escape(smart_unicode(option_label))))165 output.append(u'<option value="%s"%s>%s</option>' % (escape(option_value), selected_html, smart_unicode(escape(option_label)))) 166 166 output.append(u'</select>') 167 167 return u'\n'.join(output) 168 168