Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #2031 -- Don't try to remove microseconds on date objects (only…

… datetime)

for MySQL. Refs #316.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b70a68777709ecca75963cc03f273ee013a3eb3a 1 parent ba22f55
@malcolmt malcolmt authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  django/db/models/fields/
2  django/db/models/fields/
@@ -475,7 +475,7 @@ def get_db_prep_save(self, value):
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)
Please sign in to comment.
Something went wrong with that request. Please try again.