From ab4ffe5d78c9eb9cab1a15828dddf3c5f010ad2a Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Wed, 19 Jul 2006 05:50:33 +0000 Subject: [PATCH] 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 --- django/db/models/fields/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 2a54f2010f..e10b9beedc 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -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):