Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Added to_python implementation for NullBoolean Fields. This was requi…

…red for the XML serializer.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 400ee0266149309ccf1d36886c4a8a0524f14efc 1 parent e4e74f7
@freakboy3742 freakboy3742 authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 django/db/models/fields/
7 django/db/models/fields/
@@ -742,6 +742,13 @@ def __init__(self, *args, **kwargs):
kwargs['null'] = True
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):
return [oldforms.NullBooleanField]

0 comments on commit 400ee02

Please sign in to comment.
Something went wrong with that request. Please try again.