multiple annotate Sum terms yields inflated answer

前端 未结 2 1249
庸人自扰
庸人自扰 2020-12-14 20:32

In the following setup, I\'d like a QuerySet with a list of projects, each annotated with the sum of all its task durations (as tasks_duration) and the sum of all of its tas

2条回答
  •  别那么骄傲
    2020-12-14 21:03

    I get this error as well. Exact same code. It works if I do the aggregation separately, but once I try to get both sums at the same time, one of them gets a factor 2 higher, and the other a factor 3.

    I have no idea why Django behaves this way. I have filed a bug report here: https://code.djangoproject.com/ticket/19011 You might be interested in following it as well.

提交回复
热议问题