mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
[1.0.X] Fixed #10288 -- Corrected _has_changed handling of DateTimeInput when a custom date/time format is in use. Thanks to Koen Biermans for the report and patch.
Merge of r10641 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10757 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1071,9 +1071,9 @@ included on both widgets.
|
||||
>>> 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" />'
|
||||
|
||||
>>> w._has_changed(datetime.datetime(2008, 5, 5, 12, 40, 00), [u'2008-05-05', u'12:40:00'])
|
||||
>>> w._has_changed(datetime.datetime(2008, 5, 6, 12, 40, 00), [u'2008-05-06', u'12:40:00'])
|
||||
False
|
||||
>>> w._has_changed(datetime.datetime(2008, 5, 5, 12, 40, 00), [u'2008-05-05', u'12:41:00'])
|
||||
>>> w._has_changed(datetime.datetime(2008, 5, 6, 12, 40, 00), [u'2008-05-06', u'12:41:00'])
|
||||
True
|
||||
|
||||
# DateTimeInput ###############################################################
|
||||
@@ -1093,6 +1093,13 @@ 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" />'
|
||||
|
||||
Use 'format' to change the way a value is displayed.
|
||||
>>> w = DateTimeInput(format='%d/%m/%Y %H:%M')
|
||||
>>> w.render('date', d)
|
||||
u'<input type="text" name="date" value="17/09/2007 12:51" />'
|
||||
>>> w._has_changed(d, '17/09/2007 12:51')
|
||||
False
|
||||
|
||||
# TimeInput ###################################################################
|
||||
|
||||
>>> w = TimeInput()
|
||||
|
||||
Reference in New Issue
Block a user