Validate that the input is in self.choices.
(self, value)
| 891 | return str(value) |
| 892 | |
| 893 | def validate(self, value): |
| 894 | """Validate that the input is in self.choices.""" |
| 895 | super().validate(value) |
| 896 | if value and not self.valid_value(value): |
| 897 | raise ValidationError( |
| 898 | self.error_messages["invalid_choice"], |
| 899 | code="invalid_choice", |
| 900 | params={"value": value}, |
| 901 | ) |
| 902 | |
| 903 | def valid_value(self, value): |
| 904 | """Check to see if the provided value is a valid choice.""" |
nothing calls this directly
no test coverage detected