diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-02-23 23:48:44 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-02-23 23:48:44 +0000 |
| commit | d75e23ce9ba57af9e63a824a54249bbfb0edce99 (patch) | |
| tree | c0e7fec06e19a5bccb6ce784f53f077a310d1257 /tests/regressiontests/forms | |
| parent | 778b7bcd19c3ac540412b6f9c5888cb9f1e28d89 (diff) | |
[1.1.X] Fixed #9336. Changed CheckboxInput to render 'True' and 'False' input strings as checked or not instead of as a value attribute. Backport of r12556 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12557 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms')
| -rw-r--r-- | tests/regressiontests/forms/forms.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/forms.py b/tests/regressiontests/forms/forms.py index 2f210bda8f..dcb87ed4cf 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() |
