1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Modified BooleanField's to_python method to play nice with encode()ed strings.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3372 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2006-07-19 05:50:33 +00:00
parent 59bf8dd310
commit ab4ffe5d78

View File

@ -364,8 +364,8 @@ class BooleanField(Field):
def to_python(self, value):
if value in (True, False): return value
if value is 't' or value is 'True': return True
if value is 'f' or value is 'False': return False
if value in ('t', 'True'): return True
if value in ('f', 'False'): return False
raise validators.ValidationError, gettext("This value must be either True or False.")
def get_manipulator_field_objs(self):