summaryrefslogtreecommitdiff
path: root/django/db/models/constraints.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2019-09-09 22:58:29 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-11-21 11:56:35 +0100
commit306b6875209cfedce2536a6679e69adee7c9bc6a (patch)
treefe997bf7bc9d1dd8900f8c8d0e10756861ff3d92 /django/db/models/constraints.py
parentf69b32782e21642c6184162d888fcc17dd1dd85e (diff)
downloaddjango-306b6875209cfedce2536a6679e69adee7c9bc6a.tar.gz
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.
Diffstat (limited to 'django/db/models/constraints.py')
-rw-r--r--django/db/models/constraints.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/constraints.py b/django/db/models/constraints.py
index fe0d42a168..96205b44ad 100644
--- a/django/db/models/constraints.py
+++ b/django/db/models/constraints.py
@@ -33,7 +33,7 @@ class CheckConstraint(BaseConstraint):
super().__init__(name)
def _get_check_sql(self, model, schema_editor):
- query = Query(model=model)
+ query = Query(model=model, alias_cols=False)
where = query.build_where(self.check)
compiler = query.get_compiler(connection=schema_editor.connection)
sql, params = where.as_sql(compiler, schema_editor.connection)
@@ -77,7 +77,7 @@ class UniqueConstraint(BaseConstraint):
def _get_condition_sql(self, model, schema_editor):
if self.condition is None:
return None
- query = Query(model=model)
+ query = Query(model=model, alias_cols=False)
where = query.build_where(self.condition)
compiler = query.get_compiler(connection=schema_editor.connection)
sql, params = where.as_sql(compiler, schema_editor.connection)