mirror of
https://github.com/django/django.git
synced 2025-08-06 03:48:38 +00:00
Refs #11964 -- Removed SimpleCol in favor of Query(alias_cols).
This prevent having to pass simple_col through multiple function calls by defining whether or not references should be resolved with aliases at the Query level.
This commit is contained in:
parent
f69b32782e
commit
306b687520
6 changed files with 66 additions and 94 deletions
|
@ -38,10 +38,7 @@ class ExclusionConstraint(BaseConstraint):
|
|||
for expression, operator in self.expressions:
|
||||
if isinstance(expression, str):
|
||||
expression = F(expression)
|
||||
if isinstance(expression, F):
|
||||
expression = expression.resolve_expression(query=query, simple_col=True)
|
||||
else:
|
||||
expression = expression.resolve_expression(query=query)
|
||||
expression = expression.resolve_expression(query=query)
|
||||
sql, params = expression.as_sql(compiler, connection)
|
||||
expressions.append('%s WITH %s' % (sql % params, operator))
|
||||
return expressions
|
||||
|
@ -54,7 +51,7 @@ class ExclusionConstraint(BaseConstraint):
|
|||
return sql % tuple(schema_editor.quote_value(p) for p in params)
|
||||
|
||||
def constraint_sql(self, model, schema_editor):
|
||||
query = Query(model)
|
||||
query = Query(model, alias_cols=False)
|
||||
compiler = query.get_compiler(connection=schema_editor.connection)
|
||||
expressions = self._get_expression_sql(compiler, schema_editor.connection, query)
|
||||
condition = self._get_condition_sql(compiler, schema_editor, query)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue