From b49b59b02958354f9bb00f26aa468ce11b4815e1 Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Mon, 2 Jul 2018 22:36:40 +0500 Subject: [PATCH] Simplified SQLite's Decimal adapter. --- django/db/backends/sqlite3/base.py | 2 +- django/db/backends/utils.py | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 6237c3b6f8..7951143fd0 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -40,7 +40,7 @@ Database.register_converter("datetime", decoder(parse_datetime)) Database.register_converter("timestamp", decoder(parse_datetime)) Database.register_converter("TIMESTAMP", decoder(parse_datetime)) -Database.register_adapter(decimal.Decimal, backend_utils.rev_typecast_decimal) +Database.register_adapter(decimal.Decimal, str) class DatabaseWrapper(BaseDatabaseWrapper): diff --git a/django/db/backends/utils.py b/django/db/backends/utils.py index a574d64562..e7b9c30193 100644 --- a/django/db/backends/utils.py +++ b/django/db/backends/utils.py @@ -187,12 +187,6 @@ def typecast_timestamp(s): # does NOT store time zone information # Converters from Python to database (string) # ############################################### -def rev_typecast_decimal(d): - if d is None: - return None - return str(d) - - def split_identifier(identifier): """ Split a SQL identifier into a two element tuple of (namespace, name).