From 0cb500ea2fa5f84f244ce8ef76d6c15c596aad97 Mon Sep 17 00:00:00 2001 From: MattBlack85 Date: Thu, 11 Sep 2014 15:42:35 +0200 Subject: [PATCH] Raise ValidationError if value is not boolean or is not one of the keyword --- rest_framework/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index c0253f86b..fe0b3197e 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -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):