我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django.db.models.expressions.Func()。
def as_oracle(self, compiler, connection): # we can't mix TextField (NCLOB) and CharField (NVARCHAR), so convert # all fields to NCLOB when we expect NCLOB if self.output_field.get_internal_type() == 'TextField': class ToNCLOB(Func): function = 'TO_NCLOB' expressions = [ ToNCLOB(expression) for expression in self.get_source_expressions()] self.set_source_expressions(expressions) return super(Coalesce, self).as_sql(compiler, connection)