Django

Code

Ticket #3406: unicode-choices-checking.patch

File unicode-choices-checking.patch, 0.6 kB (added by anton@khalikov.ru, 2 years ago)

quick fix

  • django/newforms/fields.py

    old new  
    354354        value = smart_unicode(value) 
    355355        if value == u'': 
    356356            return value 
    357         valid_values = set([str(k) for k, v in self.choices]) 
     357        valid_values = set([smart_unicode(k) for k, v in self.choices]) 
    358358        if value not in valid_values: 
    359359            raise ValidationError(gettext(u'Select a valid choice. %s is not one of the available choices.') % value) 
    360360        return value