I have the following subquery:
Subquery(
ContestTaskRelationship.objects.filter(
contest=contest,
solved=OuterRef('id')
).values('cost').all()
)
I need then to annotate my QuerySet with sum of cost
values returned by each Subquery. How to do that? Wrapping the subquery in Sum returns only the first element of each subquery.