We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38115ea commit 5e047edCopy full SHA for 5e047ed
django/forms/fields.py
@@ -341,18 +341,7 @@ def to_python(self, value):
341
try:
342
return self.strptime(value, format)
343
except ValueError:
344
- if format.endswith('.%f'):
345
- # Compatibility with datetime in pythons < 2.6.
346
- # See: http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior
347
- if value.count('.') != format.count('.'):
348
- continue
349
- try:
350
- datetime_str, usecs_str = value.rsplit('.', 1)
351
- usecs = int(usecs_str[:6].ljust(6, '0'))
352
- dt = datetime.datetime.strptime(datetime_str, format[:-3])
353
- return dt.replace(microsecond=usecs)
354
- except ValueError:
355
+ continue
356
raise ValidationError(self.error_messages['invalid'])
357
358
def strptime(self, value, format):
0 commit comments