summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-08-12 17:23:01 +0200
committerClaude Paroz <claude@2xlibre.net>2014-10-28 15:06:57 +0100
commit9e746c13e81241fbf1ae64ec118edaa491790046 (patch)
tree7f857019bc24176ea419740e545694ce9dbfea1f
parentae7cb992bca5d211c9456487feb21b84387006eb (diff)
Stopped stripping microseconds with MySQL backend
Refs #19716.
-rw-r--r--django/db/backends/mysql/base.py11
-rw-r--r--docs/releases/1.8.txt8
2 files changed, 10 insertions, 9 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index 8b94319a6c..f0e184dde3 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -364,8 +364,7 @@ class DatabaseOperations(BaseDatabaseOperations):
else:
raise ValueError("MySQL backend does not support timezone-aware datetimes when USE_TZ is False.")
- # MySQL doesn't support microseconds
- return six.text_type(value.replace(microsecond=0))
+ return six.text_type(value)
def value_to_db_time(self, value):
if value is None:
@@ -375,13 +374,7 @@ class DatabaseOperations(BaseDatabaseOperations):
if timezone.is_aware(value):
raise ValueError("MySQL backend does not support timezone-aware times.")
- # MySQL doesn't support microseconds
- return six.text_type(value.replace(microsecond=0))
-
- def year_lookup_bounds_for_datetime_field(self, value):
- # Again, no microseconds
- first, second = super(DatabaseOperations, self).year_lookup_bounds_for_datetime_field(value)
- return [first.replace(microsecond=0), second.replace(microsecond=0)]
+ return six.text_type(value)
def max_name_length(self):
return 64
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index e5d3282874..b37676008b 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -160,6 +160,14 @@ Cache
* The ``incr()`` method of the
``django.core.cache.backends.locmem.LocMemCache`` backend is now thread-safe.
+Database backends
+^^^^^^^^^^^^^^^^^
+
+* The MySQL backend no longer strips microseconds from ``datetime`` values as
+ MySQL 5.6.4 and up supports fractional seconds depending on the declaration
+ of the datetime field (when ``DATETIME`` includes fractional precision greater
+ than 0).
+
Email
^^^^^