Ticket #2554: r3598_unicode_formfields.patch
File r3598_unicode_formfields.patch, 2.0 KB (added by , 18 years ago) |
---|
-
django/db/models/fields/__init__.py
290 290 return first_choice + list(self.choices) 291 291 rel_model = self.rel.to 292 292 if hasattr(self.rel, 'get_related_field'): 293 lst = [(getattr(x, self.rel.get_related_field().attname), str(x)) for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]293 lst = [(getattr(x, self.rel.get_related_field().attname), unicode(x)) for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)] 294 294 else: 295 lst = [(x._get_pk_val(), str(x)) for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)]295 lst = [(x._get_pk_val(), unicode(x)) for x in rel_model._default_manager.complex_filter(self.rel.limit_choices_to)] 296 296 return first_choice + lst 297 297 298 298 def get_choices_default(self): -
django/forms/__init__.py
158 158 159 159 def __str__(self): 160 160 "Renders the field" 161 return str(self.formfield.render(self.data))161 return unicode(self.formfield.render(self.data)) 162 162 163 163 def __repr__(self): 164 164 return '<FormFieldWrapper for "%s">' % self.formfield.field_name -
django/template/__init__.py
736 736 def encode_output(self, output): 737 737 # Check type so that we don't run str() on a Unicode object 738 738 if not isinstance(output, basestring): 739 return str(output)739 return unicode(output) 740 740 elif isinstance(output, unicode): 741 741 return output.encode(settings.DEFAULT_CHARSET) 742 742 else: