mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user