I have a fairly complex QuerySet which users a good deal of annotated values to get some counts and sums across the entire record set. The resulting rows are grouped and for each group I show the sum of this column, or the count of that column etc.
The problem is that when I slice the query set in order to paginate the data, the query is evaluate and the counts and sums now relate to the sliced query set instead of the full one.
Is there a way to avoid this, i.e., keep the sums/counts showing across the entire rows returned yet still returning a sliced query set?
I tried to see if I can cause the query set to execute first and only slice it after it had executed, but couldn't find how to do that so I don't know if that would work (would it?)
Many thanks, Harel