Commit b70a6877 authored by Malcolm Tredinnick's avatar Malcolm Tredinnick
Browse files

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
parent ba22f55a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)