Ticket #13770: case_insensitive_boolean.patch

File case_insensitive_boolean.patch, 838 bytes (added by jordanb, 14 years ago)

Patch for case-insensitive cleaning in boolean field for django 1.1.1

Line 
1*** fields.py 2010-06-15 21:43:03.000000000 -0500
2--- fields.py.NEW 2010-06-15 21:43:59.000000000 -0500
3***************
4*** 588,594 ****
5 # will submit for False. Also check for '0', since this is what
6 # RadioSelect will provide. Because bool("True") == bool('1') == True,
7 # we don't need to handle that explicitly.
8! if value in ('False', '0'):
9 value = False
10 else:
11 value = bool(value)
12--- 588,594 ----
13 # will submit for False. Also check for '0', since this is what
14 # RadioSelect will provide. Because bool("True") == bool('1') == True,
15 # we don't need to handle that explicitly.
16! if hasattr(value, "lower") and value.lower() in ('false', '0'):
17 value = False
18 else:
19 value = bool(value)
Back to Top