当前位置: 首页>>代码示例>>Python>>正文


Python Value.resolve_expression方法代码示例

本文整理汇总了Python中django.db.models.expressions.Value.resolve_expression方法的典型用法代码示例。如果您正苦于以下问题:Python Value.resolve_expression方法的具体用法?Python Value.resolve_expression怎么用?Python Value.resolve_expression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.db.models.expressions.Value的用法示例。


在下文中一共展示了Value.resolve_expression方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: process_rhs

# 需要导入模块: from django.db.models.expressions import Value [as 别名]
# 或者: from django.db.models.expressions.Value import resolve_expression [as 别名]
 def process_rhs(self, compiler, connection):
     value = self.rhs
     if self.bilateral_transforms:
         if self.rhs_is_direct_value():
             # Do not call get_db_prep_lookup here as the value will be
             # transformed before being used for lookup
             value = Value(value, output_field=self.lhs.output_field)
         value = self.apply_bilateral_transforms(value)
         value = value.resolve_expression(compiler.query)
     if hasattr(value, 'as_sql'):
         return compiler.compile(value)
     else:
         return self.get_db_prep_lookup(value, connection)
开发者ID:EmadMokhtar,项目名称:django,代码行数:15,代码来源:lookups.py

示例2: batch_process_rhs

# 需要导入模块: from django.db.models.expressions import Value [as 别名]
# 或者: from django.db.models.expressions.Value import resolve_expression [as 别名]
 def batch_process_rhs(self, compiler, connection, rhs=None):
     if rhs is None:
         rhs = self.rhs
     if self.bilateral_transforms:
         sqls, sqls_params = [], []
         for p in rhs:
             value = Value(p, output_field=self.lhs.output_field)
             value = self.apply_bilateral_transforms(value)
             value = value.resolve_expression(compiler.query)
             sql, sql_params = compiler.compile(value)
             sqls.append(sql)
             sqls_params.extend(sql_params)
     else:
         _, params = self.get_db_prep_lookup(rhs, connection)
         sqls, sqls_params = ['%s'] * len(params), params
     return sqls, sqls_params
开发者ID:carlospalol,项目名称:django,代码行数:18,代码来源:lookups.py

示例3: process_rhs

# 需要导入模块: from django.db.models.expressions import Value [as 别名]
# 或者: from django.db.models.expressions.Value import resolve_expression [as 别名]
 def process_rhs(self, compiler, connection):
     value = self.rhs
     if self.bilateral_transforms:
         if self.rhs_is_direct_value():
             # Do not call get_db_prep_lookup here as the value will be
             # transformed before being used for lookup
             value = Value(value, output_field=self.lhs.output_field)
         value = self.apply_bilateral_transforms(value)
         value = value.resolve_expression(compiler.query)
     # Due to historical reasons there are a couple of different
     # ways to produce sql here. get_compiler is likely a Query
     # instance and as_sql just something with as_sql. Finally the value
     # can of course be just plain Python value.
     if hasattr(value, 'get_compiler'):
         value = value.get_compiler(connection=connection)
     if hasattr(value, 'as_sql'):
         sql, params = compiler.compile(value)
         return '(' + sql + ')', params
     else:
         return self.get_db_prep_lookup(value, connection)
开发者ID:CrazyChief,项目名称:django,代码行数:22,代码来源:lookups.py

示例4:

# 需要导入模块: from django.db.models.expressions import Value [as 别名]
# 或者: from django.db.models.expressions.Value import resolve_expression [as 别名]
from copy import copy
开发者ID:letouriste001,项目名称:SmartForest_2.0,代码行数:3,代码来源:lookups.py


注:本文中的django.db.models.expressions.Value.resolve_expression方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。