summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2010-02-23 23:37:45 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2010-02-23 23:37:45 +0000
commit445e0a5c3e40dbcfd866b4594371b0fa49fdc223 (patch)
tree1ef9eba6f0b5ec742416ffc30eab4aa3f7ef085e /django/forms
parentd47b9ec2c71868105df41e50020c9ec2eae76b62 (diff)
Fixed #9336. Changed CheckboxInput to render 'True' and 'False' input strings as checked or not instead of as a value attribute. Thanks, bthomas.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12556 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/widgets.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 57bdea17f4..ee1966b76f 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -382,7 +382,12 @@ class CheckboxInput(Widget):
# A missing value means False because HTML form submission does not
# send results for unselected checkboxes.
return False
- return super(CheckboxInput, self).value_from_datadict(data, files, name)
+ value = data.get(name)
+ # Translate true and false strings to boolean values.
+ values = {'true': True, 'false': False}
+ if isinstance(value, basestring):
+ value = values.get(value.lower(), value)
+ return value
def _has_changed(self, initial, data):
# Sometimes data or initial could be None or u'' which should be the