Python django.db.models.expressions 模块,Func() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django.db.models.expressions.Func()

项目:django-wechat-api    作者:crazy-canux    | 项目源码 | 文件源码
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)