def validate(self, value):
        """
        Validates that the input is in self.choices.
        """
        super(ChoiceField, self).validate(value)
        if value and not self.valid_value(value):
            raise ValidationError(self.error_messages['invalid_choice'] % {'value': value})
dataset/ETHPy150Open adieu/django-nonrel/django/forms/fields.py/ChoiceField.validate/original