Ticket #3370: models-utf8.diff
File models-utf8.diff, 965 bytes (added by , 18 years ago) |
---|
-
models.py
8 8 from forms import BaseForm, DeclarativeFieldsMetaclass, SortedDictFromList 9 9 from fields import Field, ChoiceField 10 10 from widgets import Select, SelectMultiple, MultipleHiddenInput 11 from django.conf import settings 11 12 12 13 __all__ = ('save_instance', 'form_for_model', 'form_for_instance', 'form_for_fields', 13 14 'ModelChoiceField', 'ModelMultipleChoiceField') … … 38 39 for f in opts.fields: 39 40 if not f.editable or isinstance(f, models.AutoField): 40 41 continue 41 setattr(instance, f.name, clean_data[f.name]) 42 try: 43 setattr(instance, f.name, clean_data[f.name].encode(settings.DEFAULT_CHARSET)) 44 except: 45 setattr(instance, f.name, clean_data[f.name]) 42 46 if commit: 43 47 instance.save() 44 48 for f in opts.many_to_many: