mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Raise ValidationError if value is not boolean or is not one of the keyword
This commit is contained in:
parent
2937285790
commit
0cb500ea2f
|
@ -454,7 +454,7 @@ class BooleanField(WritableField):
|
|||
return True
|
||||
if value in ('false', 'f', 'False', '0'):
|
||||
return False
|
||||
return bool(value)
|
||||
raise ValidationError(self.error_messages['invalid'] % _(value))
|
||||
|
||||
|
||||
class CharField(WritableField):
|
||||
|
|
Loading…
Reference in New Issue
Block a user