From e38d54e19a219efedb1b466d77d917bdbb3445f6 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sat, 20 Oct 2007 12:21:07 +0000 Subject: Changed newforms.CheckboxInput widget to return False as its value when not include in the form (since HTML form submission doesn't send unselected check boxes). Patch from SmileyChris. Refs #5104. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6563 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/forms/widgets.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/regressiontests/forms') diff --git a/tests/regressiontests/forms/widgets.py b/tests/regressiontests/forms/widgets.py index 1c3e873963..6b7c858041 100644 --- a/tests/regressiontests/forms/widgets.py +++ b/tests/regressiontests/forms/widgets.py @@ -276,6 +276,12 @@ u'' >>> w.render('greeting', None) u'' +The CheckboxInput widget will return False if the key is not found in the data +dictionary (because HTML form submission doesn't send any result for unchecked +checkboxes). +>>> w.value_from_datadict({}, {}, 'testing') +False + # Select Widget ############################################################### >>> w = Select() -- cgit v1.3