Ticket #6937: patch.diff
File patch.diff, 1.2 KB (added by , 16 years ago) |
---|
-
trunk/django/forms/fields.py
577 577 # Explicitly check for the string 'False', which is what a hidden field 578 578 # will submit for False. Because bool("True") == True, we don't need to 579 579 # handle that explicitly. 580 if value == 'False':580 if isinstance(value,str) and value.lower() in ('f', 'false', '0','no'): 581 581 value = False 582 582 else: 583 583 value = bool(value) -
trunk/tests/regressiontests/forms/fields.py
1011 1011 False 1012 1012 >>> f.clean('Django rocks') 1013 1013 True 1014 >>> f.clean('f') 1015 False 1016 >>> f.clean('falSe') 1017 False 1018 >>> f.clean('FALSE') 1019 False 1020 >>> f.clean('0') 1021 False 1022 >>> f.clean('f') 1023 False 1024 >>> f.clean('no') 1025 False 1026 >>> f.clean('No') 1027 False 1014 1028 1015 1029 A form's BooleanField with a hidden widget will output the string 'False', so 1016 1030 that should clean to the boolean value False: