#10929: Support a default value for Sum (and possibly other aggregation
functions)
-------------------------------------+-------------------------------------
Reporter: nolan | Owner: (none)
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: aggregate annotate | Triage Stage: Accepted
default |
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
Note that the new aggregate functions in `django.contrib.postgres`
[https://github.com/django/django/blob/4de8aaf7ffc91b91cbb70e9db406abe9b160575a/django/contrib/postgres/aggregates/general.py#L12-L15
silently handle this].
I still believe adding a `coalesce` sugar argument to aggregate functions
would be more appropriate than a `default` one as it would allow passing
expressions instead of simple Python value.
e.g.
{{{#!python
Sum('amount', coalesce=F('minimum_amount')
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/10929#comment:20>
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/063.2b0a6e3d178858da48eb7d8555c53192%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.