summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Bordage <bordage.bertrand@gmail.com>2017-06-02 21:05:07 (GMT)
committerGitHub <noreply@github.com>2017-06-02 21:05:07 (GMT)
commite9babc6e70964ff5f7042c52a7121616ca2ebae9 (patch)
tree2d0722a8edf13438a069e0ff435a9cf64896925b
parentc9ac4080d2d751987597c2464e25ee5e7b849218 (diff)
parent179d8f2e21f8d8b6c23c2dba420cf92af5f58567 (diff)
downloaddjango-cachalot-e9babc6e70964ff5f7042c52a7121616ca2ebae9.zip
django-cachalot-e9babc6e70964ff5f7042c52a7121616ca2ebae9.tar.gz
django-cachalot-e9babc6e70964ff5f7042c52a7121616ca2ebae9.tar.bz2
Merge pull request #80 from izimobil/master
Fixed django>=1.11 support.
-rw-r--r--cachalot/utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/cachalot/utils.py b/cachalot/utils.py
index c1768e9..5d92113 100644
--- a/cachalot/utils.py
+++ b/cachalot/utils.py
@@ -162,7 +162,7 @@ def _get_tables(query, db_alias):
subquery_constraints = _find_subqueries(query.where.children)
for subquery in subquery_constraints:
tables.update(_get_tables(subquery, db_alias))
- if query.extra_select or hasattr(query, 'subquery') \
+ if query.extra_select or (hasattr(query, 'subquery') and query.subquery) \
or any(c.__class__ is ExtraWhere for c in query.where.children):
sql = query.get_compiler(db_alias).as_sql()[0].lower()
additional_tables = _get_tables_from_sql(connections[db_alias], sql)