summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms/forms.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2010-09-12 22:27:59 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2010-09-12 22:27:59 +0000
commit631bb7d0f6f4160b8d4034392f5f1e1b31490aae (patch)
treed81fc63f71efa487f1d37964410042ad4e23b528 /tests/regressiontests/forms/forms.py
parent1e7b2f5a06885efe5d4436498ace4272c562f16a (diff)
Added a test for hidden SplitDateTime fields. Thanks, seveas.
Fixed #11213 git-svn-id: http://code.djangoproject.com/svn/django/trunk@13816 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms/forms.py')
-rw-r--r--tests/regressiontests/forms/forms.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/forms.py b/tests/regressiontests/forms/forms.py
index 9e45a267db..91594139f2 100644
--- a/tests/regressiontests/forms/forms.py
+++ b/tests/regressiontests/forms/forms.py
@@ -522,6 +522,18 @@ tags.
<input type="hidden" name="composers" value="P" />
<input type="hidden" name="composers" value="J" />
+DateTimeField rendered as_hidden() is special too
+
+>>> class MessageForm(Form):
+... when = SplitDateTimeField()
+>>> f = MessageForm({'when_0': '1992-01-01', 'when_1': '01:01'})
+>>> print f.is_valid()
+True
+>>> print f['when']
+<input type="text" name="when_0" value="1992-01-01" id="id_when_0" /><input type="text" name="when_1" value="01:01" id="id_when_1" />
+>>> print f['when'].as_hidden()
+<input type="hidden" name="when_0" value="1992-01-01" id="id_when_0" /><input type="hidden" name="when_1" value="01:01" id="id_when_1" />
+
MultipleChoiceField can also be used with the CheckboxSelectMultiple widget.
>>> class SongForm(Form):
... name = CharField()