#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)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  aggregate annotate   |      Needs documentation:  1
  default                            |  Patch needs improvement:  0
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/10929#comment:12>
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.f4861d021deac2abbfb249bf689e0cac%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to