summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-05-13 14:31:39 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-05-13 14:31:39 +0000
commit17d214a9821542696b4b632b1fc70086ed2f7ecc (patch)
tree6b125fcd9ba7113fb1909fffaaf4d40a174911fe /tests
parentcc96ed9ecd08a612094d2a43571cd81fb98f60a0 (diff)
[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
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/forms/widgets.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/regressiontests/forms/widgets.py b/tests/regressiontests/forms/widgets.py
index 51b3356bed..8f03cff271 100644
--- a/tests/regressiontests/forms/widgets.py
+++ b/tests/regressiontests/forms/widgets.py
@@ -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()