Ticket #5328: newforms-choice-field-clean-r6040.diff
File newforms-choice-field-clean-r6040.diff, 625 bytes (added by , 17 years ago) |
---|
-
fields.py
old new 469 469 """ 470 470 value = super(ChoiceField, self).clean(value) 471 471 if value in EMPTY_VALUES: 472 value =u''472 return u'' 473 473 value = smart_unicode(value) 474 if value == u'':475 return value476 474 valid_values = set([smart_unicode(k) for k, v in self.choices]) 477 475 if value not in valid_values: 478 476 raise ValidationError(ugettext(u'Select a valid choice. That choice is not one of the available choices.'))