Skip to content

Commit

Permalink
Fix annotations introspection in Django 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Suor committed Sep 26, 2020
1 parent 8314c37 commit 0527e22
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cacheops/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def table_for(alias):
if qs.query.annotations:
subqueries = (
# Django 3.0+ sets Subquery.query
query_dnf(getattr(q, 'query', q.queryset.query)) for q in qs.query.annotations.values()
query_dnf(getattr(q, 'query', None) or getattr(q, 'queryset').query)
for q in qs.query.annotations.values()
if type(q) is Subquery
)
dnfs_.update(join_with(lcat, subqueries))
Expand Down

0 comments on commit 0527e22

Please sign in to comment.