summaryrefslogtreecommitdiff
path: root/tests/regressiontests/forms
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-21 14:50:47 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-21 14:50:47 +0000
commit1671fc48ab9f1c73ef04a10f0eb9e1f8452cd004 (patch)
tree1a5290e5d6429e93d5d50829b8ddde0ecadd5bcd /tests/regressiontests/forms
parentf5831b03c908d9d4bf59f0a0cef4e3db221367ca (diff)
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
Diffstat (limited to 'tests/regressiontests/forms')
-rw-r--r--tests/regressiontests/forms/widgets.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/forms/widgets.py b/tests/regressiontests/forms/widgets.py
index 6b7c858041..032f3cbb91 100644
--- a/tests/regressiontests/forms/widgets.py
+++ b/tests/regressiontests/forms/widgets.py
@@ -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" />'
"""