Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 631bb7d0f6f4160b8d4034392f5f1e1b31490aae 1 parent 1e7b2f5
@malcolmt malcolmt authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 tests/regressiontests/forms/forms.py
View
12 tests/regressiontests/forms/forms.py
@@ -522,6 +522,18 @@
<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()
Please sign in to comment.
Something went wrong with that request. Please try again.