mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #7499 -- Trim microseconds off rendering of form.TimeFields by default so
that they validate. Previous code didn't work with microseconds anyway, so this is backwards compatible. Thanks to kevin for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8491 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1087,4 +1087,22 @@ u'<input type="text" name="date" value="2007-09-17 12:51:34" />'
|
||||
u'<input type="text" name="date" value="2007-09-17 12:51:34" />'
|
||||
>>> w.render('date', datetime.datetime(2007, 9, 17, 12, 51))
|
||||
u'<input type="text" name="date" value="2007-09-17 12:51:00" />'
|
||||
|
||||
# TimeInput ###############################################################
|
||||
|
||||
>>> w = TimeInput()
|
||||
>>> w.render('time', None)
|
||||
u'<input type="text" name="time" />'
|
||||
>>> t = datetime.time(12, 51, 34, 482548)
|
||||
>>> print t
|
||||
12:51:34.482548
|
||||
|
||||
The microseconds are trimmed on display, by default.
|
||||
>>> w.render('time', t)
|
||||
u'<input type="text" name="time" value="12:51:34" />'
|
||||
>>> w.render('time', datetime.time(12, 51, 34))
|
||||
u'<input type="text" name="time" value="12:51:34" />'
|
||||
>>> w.render('time', datetime.time(12, 51))
|
||||
u'<input type="text" name="time" value="12:51:00" />'
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user