diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index 1ab9b49..8e45d8f 100644
a
|
b
|
TIME_INPUT_FORMATS = (
|
358 | 358 | # * Note that these format strings are different from the ones to display dates |
359 | 359 | DATETIME_INPUT_FORMATS = ( |
360 | 360 | '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' |
| 361 | '%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200' |
361 | 362 | '%Y-%m-%d %H:%M', # '2006-10-25 14:30' |
362 | 363 | '%Y-%m-%d', # '2006-10-25' |
363 | 364 | '%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59' |
diff --git a/django/forms/fields.py b/django/forms/fields.py
index a5ea81d..612abec 100644
a
|
b
|
import copy
|
6 | 6 | import datetime |
7 | 7 | import os |
8 | 8 | import re |
| 9 | import sys |
9 | 10 | import time |
10 | 11 | import urlparse |
11 | 12 | import warnings |
… |
… |
class BaseTemporalField(Field):
|
335 | 336 | # If unicode, try to strptime against each input format. |
336 | 337 | if isinstance(value, unicode): |
337 | 338 | for format in self.input_formats: |
| 339 | if format.endswith('.%f') and sys.version_info[:2]<=(2,6): |
| 340 | if not value.count('.')==1: |
| 341 | continue |
| 342 | try: |
| 343 | value, usecs = value.rsplit('.', 1) |
| 344 | usecs = int(usecs) |
| 345 | return datetime.datetime(*time.strptime(value, format[:-3])[:6]+(usecs,)) |
| 346 | except ValueError: |
| 347 | continue |
338 | 348 | try: |
339 | 349 | return self.strptime(value, format) |
340 | 350 | except ValueError: |
diff --git a/tests/regressiontests/forms/tests/fields.py b/tests/regressiontests/forms/tests/fields.py
index 2303b4e..03ad5bb 100644
a
|
b
|
class FieldsTests(TestCase):
|
387 | 387 | self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30), f.clean('10/25/2006 14:30:00')) |
388 | 388 | self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30), f.clean('10/25/2006 14:30')) |
389 | 389 | self.assertEqual(datetime.datetime(2006, 10, 25, 0, 0), f.clean('10/25/2006')) |
| 390 | self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30, 45, 200), f.clean('2006-10-25 14:30:45.000200')) |
390 | 391 | self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30, 45), f.clean('10/25/06 14:30:45')) |
391 | 392 | self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30), f.clean('10/25/06 14:30:00')) |
392 | 393 | self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30), f.clean('10/25/06 14:30')) |