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)

  1. builtins.object
  2. 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