summaryrefslogtreecommitdiff
path: root/tests/regressiontests/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 /tests/regressiontests/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 'tests/regressiontests/forms')
-rw-r--r--tests/regressiontests/forms/forms.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/forms.py b/tests/regressiontests/forms/forms.py
index c4ea28f850..bb58eaa982 100644
--- a/tests/regressiontests/forms/forms.py
+++ b/tests/regressiontests/forms/forms.py
@@ -295,6 +295,24 @@ attribute in the Form gets precedence.
>>> print f['get_spam']
<input checked="checked" type="checkbox" name="get_spam" />
+'True' or 'true' should be rendered without a value attribute
+>>> f = SignupForm({'email': 'test@example.com', 'get_spam': 'True'}, auto_id=False)
+>>> print f['get_spam']
+<input checked="checked" type="checkbox" name="get_spam" />
+
+>>> f = SignupForm({'email': 'test@example.com', 'get_spam': 'true'}, auto_id=False)
+>>> print f['get_spam']
+<input checked="checked" type="checkbox" name="get_spam" />
+
+A value of 'False' or 'false' should be rendered unchecked
+>>> f = SignupForm({'email': 'test@example.com', 'get_spam': 'False'}, auto_id=False)
+>>> print f['get_spam']
+<input type="checkbox" name="get_spam" />
+
+>>> f = SignupForm({'email': 'test@example.com', 'get_spam': 'false'}, auto_id=False)
+>>> print f['get_spam']
+<input type="checkbox" name="get_spam" />
+
Any Field can have a Widget class passed to its constructor:
>>> class ContactForm(Form):
... subject = CharField()