class SQLiteNumericMixin
from django.db.models.expressions import SQLiteNumericMixin
Some expressions with output_field=DecimalField() must be cast to numeric to be properly filtered.
Ancestors (MRO)
- builtins.object
- django.db.models.expressions.SQLiteNumericMixin
def as_sqlite(self, compiler, connection, **extra_context)
django.db.models.expressions.SQLiteNumericMixin
def as_sqlite(self, compiler, connection, **extra_context):
sql, params = self.as_sql(compiler, connection, **extra_context)
try:
if self.output_field.get_internal_type() == "DecimalField":
sql = "(CAST(%s AS NUMERIC))" % sql
except FieldError:
pass
return sql, params