From be29329ccd49a84d3f7238111aebf97c4aaac581 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 26 Oct 2012 20:44:00 +0200 Subject: Fixed #16820 -- Treated '0' value as True for checkbox inputs Thanks Dan Fairs for the report and the initial patch. --- django/forms/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/forms') 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 -- cgit v1.3