From 2ffe564e3ead5809e4392ec93bfdb4083df7d28a Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Fri, 18 Dec 2015 17:07:53 +0100 Subject: [PATCH] Fixes Django 1.7+1.8 compatibility. --- cachalot/utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cachalot/utils.py b/cachalot/utils.py index b9abe63..0f74370 100644 --- a/cachalot/utils.py +++ b/cachalot/utils.py @@ -128,10 +128,9 @@ def _get_tables(query, db_alias): tables = set(query.table_map) tables.add(query.get_meta().db_table) - children = query.where.children - if DJANGO_LTE_1_8: - children += query.having.children - subquery_constraints = _find_subqueries(children) + subquery_constraints = _find_subqueries( + query.where.children + query.having.children if DJANGO_LTE_1_8 + else query.where.children) for subquery in subquery_constraints: tables.update(_get_tables(subquery, db_alias)) if query.extra_select or hasattr(query, 'subquery') \