mirror of https://github.com/django/django.git
Fixed #2031 -- Don't try to remove microseconds on date objects (only datetime)
for MySQL. Refs #316. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3183 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ba22f55aa2
commit
b70a687777
|
@ -475,7 +475,7 @@ class DateTimeField(DateField):
|
|||
if value is not None:
|
||||
# MySQL will throw a warning if microseconds are given, because it
|
||||
# doesn't support microseconds.
|
||||
if settings.DATABASE_ENGINE == 'mysql':
|
||||
if settings.DATABASE_ENGINE == 'mysql' and hasattr(value, 'microsecond'):
|
||||
value = value.replace(microsecond=0)
|
||||
value = str(value)
|
||||
return Field.get_db_prep_save(self, value)
|
||||
|
|
Loading…
Reference in New Issue