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:
Malcolm Tredinnick 2006-06-21 04:13:48 +00:00
parent ba22f55aa2
commit b70a687777
1 changed files with 1 additions and 1 deletions

View File

@ -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)