summaryrefslogtreecommitdiff
path: root/django/forms/widgets.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-10-26 20:44:00 +0200
committerClaude Paroz <claude@2xlibre.net>2012-10-26 20:44:00 +0200
commitbe29329ccd49a84d3f7238111aebf97c4aaac581 (patch)
treea28703c990cb40466fc0cbec4851ca5ad89edd82 /django/forms/widgets.py
parent90c76564669fa03caefcf4318ffdf9ba8fa4d40b (diff)
Fixed #16820 -- Treated '0' value as True for checkbox inputs
Thanks Dan Fairs for the report and the initial patch.
Diffstat (limited to 'django/forms/widgets.py')
-rw-r--r--django/forms/widgets.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 763da0cff2..061988c6c0 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -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