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