#20930: Arithmetic operations on aggregates
-------------------------------------+-------------------------------------
Reporter: debanshuk | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage:
Keywords: aggregate, annotate | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by debanshuk):
Well...not exactly duplicate, as #14030 is for something like this:
{{{
Xyz.objects.aggregate(Sum(F('a')/F('b')*100))
}}}
but I guess #14030 can be extended to implement functionality of this
ticket. In case of `annotate` something like this can be done:
{{{
Xyz.objects.values('user').annotate(total_a=Sum('a'),
total_b=Sum('b')).values(F('total_a')/F('total_b')*100)
}}}
**But**, in case of `aggregate` this wont work as `aggregate` returns
`dict` (not `QuerySet`). So, I guess some changes are required for
`aggregate`.
--
Ticket URL: <https://code.djangoproject.com/ticket/20930#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.3ce42706c8f65715648fe84357034aca%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.