Index: django/forms/widgets.py
===================================================================
--- django/forms/widgets.py (revision 10686)
+++ django/forms/widgets.py (working copy)
@@ -381,7 +381,8 @@
# 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)
+ return {'True': True, 'False': False}.get(value, value)
def _has_changed(self, initial, data):
# Sometimes data or initial could be None or u'' which should be the
Index: tests/regressiontests/forms/forms.py
===================================================================
--- tests/regressiontests/forms/forms.py (revision 10686)
+++ tests/regressiontests/forms/forms.py (working copy)
@@ -295,6 +295,16 @@
>>> print f['get_spam']
+'True' should be rendered without a value attribute
+>>> f = SignupForm({'email': 'test@example.com', 'get_spam': 'True'}, auto_id=False)
+>>> print f['get_spam']
+
+
+A value of 'False' should be rendered unchecked
+>>> f = SignupForm({'email': 'test@example.com', 'get_spam': 'False'}, auto_id=False)
+>>> print f['get_spam']
+
+
Any Field can have a Widget class passed to its constructor:
>>> class ContactForm(Form):
... subject = CharField()