summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-06-21 04:13:48 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-06-21 04:13:48 +0000
commitb70a68777709ecca75963cc03f273ee013a3eb3a (patch)
tree739935bc3d9e8e4b6fb36e5a42a1ddd04f9be16b
parentba22f55aa2766cb6a0b58c0e1be6164a48adcb02 (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__.py2
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)