Merge pull request #80 from izimobil/master

Fixed django>=1.11 support.
This commit is contained in:
Bertrand Bordage 2017-06-02 23:05:07 +02:00 committed by GitHub
commit e9babc6e70
1 changed files with 1 additions and 1 deletions

View File

@ -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)