You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case where I need to return empty query set. I used MyModel.objects.none() query. But, the resulting queryset doesnt give proper result for functions like .sum()
For eg.
I have a model called Plot with a field area.
If I have a queryset with n number of plots, and do .sum('area'), it gives me sum of area of objects in the qureyset as expected. But, when the queryset is empty, it returns sum of area of all objects in Plot, rather than the expected 0.
The text was updated successfully, but these errors were encountered:
I have a use case where I need to return empty query set. I used MyModel.objects.none() query. But, the resulting queryset doesnt give proper result for functions like .sum()
For eg.
I have a model called Plot with a field area.
If I have a queryset with n number of plots, and do .sum('area'), it gives me sum of area of objects in the qureyset as expected. But, when the queryset is empty, it returns sum of area of all objects in Plot, rather than the expected 0.
The text was updated successfully, but these errors were encountered: