diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-06-21 04:13:48 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-06-21 04:13:48 +0000 |
| commit | b70a68777709ecca75963cc03f273ee013a3eb3a (patch) | |
| tree | 739935bc3d9e8e4b6fb36e5a42a1ddd04f9be16b | |
| parent | ba22f55aa2766cb6a0b58c0e1be6164a48adcb02 (diff) | |
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
| -rw-r--r-- | django/db/models/fields/__init__.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 720737efcf..bc6042ae59 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -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) |
