From e89fe839927aeb122e77656309ccefab7880f83b Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Sun, 24 May 2015 18:28:16 +0200 Subject: [PATCH] Fixes the AttributeError happening when excluding through a M2M on a multi-table inheritance child model. --- cachalot/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cachalot/utils.py b/cachalot/utils.py index 104c65d..a0b2fd6 100644 --- a/cachalot/utils.py +++ b/cachalot/utils.py @@ -67,7 +67,10 @@ def _get_tables_from_sql(connection, lowercased_sql): def _find_subqueries(children): for child in children: if isinstance(child, SubqueryConstraint): - yield child.query_object.query + if isinstance(child.query_object, Query): + yield child.query_object + else: + yield child.query_object.query else: rhs = None if DJANGO_GTE_1_7: