django/db/models/expressions.py
168 169 def set_source_expressions(self, exprs): --> 170 assert len(exprs) == 0 171 172 def _parse_expressions(self, *expressions): AssertionError:
exprs | [Ref(__col8, Col(U0, myapp.Vote.comment))] |
self | <django.db.models.expressions.Subquery object at 0x1080077b8> |
Though I can’t address the issue of whether it is a bug, there is a note in the documentation:
https://docs.djangoproject.com/en/2.1/topics/db/aggregation/#filtering-on-annotations
“Avoid using the filter argument…”
You may want to consider conditional expressions (Case … When) to achieve your goal.
https://docs.djangoproject.com/en/2.1/ref/models/conditional-expressions/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
django-users...@googlegroups.com.
To post to this group, send email to
django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/d405cbf2-0a57-4639-aac1-4376a09099b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I assume you are trying to workaround the cross join of multiple table annotations?
There's tickets tracking adding subquery support to aggregate functions butusing subqueries doesn't seem to be necessary here?
You may want to consider conditional expressions (Case … When) to achieve your goal.
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/JfZguPo-G_g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/44dcbf0e-e766-4ba9-a9e6-05ebf1a1709f%40googlegroups.com.