1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

newforms-admin: Merged from trunk up to [5916]

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2007-08-17 15:05:54 +00:00
parent 0f92ac52cb
commit fcec755f01
112 changed files with 13108 additions and 7247 deletions

View File

@@ -3636,6 +3636,29 @@ True
<option value="2016">2016</option>
</select>
Using a SelectDateWidget in a form:
>>> class GetDate(Form):
... mydate = DateField(widget=SelectDateWidget)
>>> a = GetDate({'mydate_month':'4', 'mydate_day':'1', 'mydate_year':'2008'})
>>> print a.is_valid()
True
>>> print a.cleaned_data['mydate']
2008-04-01
As with any widget that implements get_value_from_datadict,
we must be prepared to accept the input from the "as_hidden"
rendering as well.
>>> print a['mydate'].as_hidden()
<input type="hidden" name="mydate" value="2008-4-1" id="id_mydate" />
>>> b=GetDate({'mydate':'2008-4-1'})
>>> print b.is_valid()
True
>>> print b.cleaned_data['mydate']
2008-04-01
# MultiWidget and MultiValueField #############################################
# MultiWidgets are widgets composed of other widgets. They are usually
# combined with MultiValueFields - a field that is composed of other fields.