Commit 4a54d9f4 by htmis Committed by GitHub

Update Boolean field to more closely match python library

Python Reference:
distutils.util.strtobool(val)
Convert a string representation of truth to true (1) or false (0).
True values are y, yes, t, true, on and 1; false values are n, no, f, false, off and 0. Raises ValueError if val is anything else.
parent 43691575
...@@ -649,6 +649,7 @@ class BooleanField(Field): ...@@ -649,6 +649,7 @@ class BooleanField(Field):
initial = False initial = False
TRUE_VALUES = { TRUE_VALUES = {
't', 'T', 't', 'T',
'y', 'Y', 'yes', 'YES',
'true', 'True', 'TRUE', 'true', 'True', 'TRUE',
'on', 'On', 'ON', 'on', 'On', 'ON',
'1', 1, '1', 1,
...@@ -656,6 +657,7 @@ class BooleanField(Field): ...@@ -656,6 +657,7 @@ class BooleanField(Field):
} }
FALSE_VALUES = { FALSE_VALUES = {
'f', 'F', 'f', 'F',
'n', 'N', 'no', 'NO',
'false', 'False', 'FALSE', 'false', 'False', 'FALSE',
'off', 'Off', 'OFF', 'off', 'Off', 'OFF',
'0', 0, 0.0, '0', 0, 0.0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment