def convert_decimalfield_value(self, value, expression, connection):
if value is not None:
value = expression.output_field.format_number(value)
# Value is not converted to Decimal here as it will be converted
# later in BaseExpression.convert_value().
return value
FROM Django 2.1
def get_decimalfield_converter(self, expression):
# SQLite stores only 15 significant digits. Digits coming from
# float inaccuracy must be removed.
create_decimal = decimal.Context(prec=15).create_decimal_from_float
if isinstance(expression, Col):
quantize_value = decimal.Decimal(1).scaleb(-expression.output_field.decimal_places)
def converter(value, expression, connection):
if value is not None:
return create_decimal(value).quantize(quantize_value, context=expression.output_field.context)
else:
def converter(value, expression, connection):
if value is not None:
return create_decimal(value)
return converter
Has anyone faced this issue....not sure what other details to provide...happy to provide more upon request.
Python 3.5.9 (default, Nov 24 2019, 01:35:13)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.0.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import sqlite3
In [2]: sqlite3.version
Out[2]: '2.6.0'
In [3]: sqlite3.sqlite_version
Out[3]: '3.22.0'
Django==2.1.15
mysqlclient==1.3.9
NumPy==1.11.1
pandas==0.19.2