#10929: Support a default value for Sum (and possibly other aggregation
functions)
-------------------------------------+-------------------------------------
Reporter: nolan | Owner:
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 digismack):
Replying to [comment:12 jarshwah]:
> @mrmachine that's not a bad argument to make. What we could support is:
>
> {{{
> Sum('field', default=0)
> }}}
>
> Which would then be returned from {{{ convert_value }}} in the case
where the value is None. The argument against that is we'd be special-
casing the Sum aggregate, while leaving other aggregates to use the
Coalesce method. That's not such a big downside though.
>
> Does anyone else want to weigh in on this? Supporting a default=0 kwarg
is a 4 line + docs change.
I ran into a situation today where this feature would have been nice. +1
from me.
--
Ticket URL: <https://code.djangoproject.com/ticket/10929#comment:15>
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.87aa3d96dc2cb72526628d6cc247fe42%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.