mirror of
https://github.com/django/django.git
synced 2025-07-25 14:14:13 +00:00
Fixed #16820 -- Treated '0' value as True for checkbox inputs
Thanks Dan Fairs for the report and the initial patch.
This commit is contained in:
parent
90c7656466
commit
be29329ccd
3 changed files with 10 additions and 1 deletions
|
@ -528,7 +528,7 @@ class CheckboxInput(Widget):
|
|||
values = {'true': True, 'false': False}
|
||||
if isinstance(value, six.string_types):
|
||||
value = values.get(value.lower(), value)
|
||||
return value
|
||||
return bool(value)
|
||||
|
||||
def _has_changed(self, initial, data):
|
||||
# Sometimes data or initial could be None or '' which should be the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue