I have a query akin to the following:
SELECT SUM(name) FROM table WHERE name IS NULL
How does that SUM translate into a QuerySet in Django? i.e. What operation xyz does it translate to, in something like MyModel.objects.xyz()?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Update: The following incorporates the ISNULL aspect of the original query:
You’re looking for the Sum aggregation function, which works as follows:
See: https://docs.djangoproject.com/en/dev/ref/models/querysets/#sum