Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty Query Set not really empty #62

Open
nithyamary opened this issue Jun 21, 2016 · 1 comment
Open

Empty Query Set not really empty #62

nithyamary opened this issue Jun 21, 2016 · 1 comment

Comments

@nithyamary
Copy link

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.

@last-partizan
Copy link
Contributor

Yeah, i've seen similar bug but not have time to dig around.
If you can - take a look at sources and try to figure out what's happening.

@last-partizan last-partizan changed the title Empty Query Set Empty Query Set not really empty Jun 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants