Added to_python implementation for NullBoolean Fields. This was required for the XML serializer.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e4e74f7e1d
commit
400ee02661
|
@ -742,6 +742,13 @@ class NullBooleanField(Field):
|
||||||
kwargs['null'] = True
|
kwargs['null'] = True
|
||||||
Field.__init__(self, *args, **kwargs)
|
Field.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
|
def to_python(self, value):
|
||||||
|
if value in (None, True, False): return value
|
||||||
|
if value in ('None'): return None
|
||||||
|
if value in ('t', 'True', '1'): return True
|
||||||
|
if value in ('f', 'False', '0'): return False
|
||||||
|
raise validators.ValidationError, gettext("This value must be either None, True or False.")
|
||||||
|
|
||||||
def get_manipulator_field_objs(self):
|
def get_manipulator_field_objs(self):
|
||||||
return [oldforms.NullBooleanField]
|
return [oldforms.NullBooleanField]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue