Commits

skoczen committed c75cf83

Changed tables list to accoutn for aliases. Fixes caching bug with subqueries.

Comments (0)

Files changed (1)

     with their own dependent queries, etc."""
     from django.db.models.sql.where import WhereNode
     from django.db.models.query import QuerySet
-    tables = list(query.tables) or getattr(query, 'table_map', {}).keys()
+    tables = [v[0] for v in getattr(query,'alias_map',{}).values()]
 
     def get_tables(where_node, tables):
         for child in where_node.children: