mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Changed the default form presentation of datetime values to not include the
fractional second values (they usually aren't going to be needed). Based on patches from yi.codeplayer@gmail.com, andrews and Wiliam Alves de Souza. Fixed #4428, #4487 git-svn-id: http://code.djangoproject.com/svn/django/trunk@6578 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -851,4 +851,19 @@ included on both widgets.
|
||||
>>> w = SplitDateTimeWidget(attrs={'class': 'pretty'})
|
||||
>>> w.render('date', datetime.datetime(2006, 1, 10, 7, 30))
|
||||
u'<input type="text" class="pretty" value="2006-01-10" name="date_0" /><input type="text" class="pretty" value="07:30:00" name="date_1" />'
|
||||
|
||||
# DateTimeInput ###############################################################
|
||||
|
||||
>>> w = DateTimeInput()
|
||||
>>> d = datetime.datetime(2007, 9, 17, 12, 51, 34, 482548)
|
||||
>>> print d
|
||||
2007-09-17 12:51:34.482548
|
||||
|
||||
The microseconds are trimmed on display, by default.
|
||||
>>> w.render('date', d)
|
||||
u'<input type="text" name="date" value="2007-09-17 12:51:34" />'
|
||||
>>> w.render('date', datetime.datetime(2007, 9, 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" />'
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user