#10929: Support a default value for Sum (and possibly other aggregation functions) ------------------------------------------+--------------------------------- Reporter: nolan | Owner: nobody Status: new | Milestone: Component: Database layer (models, ORM) | Version: 1.1-beta-1 Keywords: | Stage: Unreviewed Has_patch: 0 | ------------------------------------------+--------------------------------- By default, annotate(sum_field = Sum(...)) results in sum_field being NULL if there were no values to sum. In most cases, 0 would be a better option here, for proper sorting in a later order_by, and for comparisons using lt/gt/gte/lte.
A monkeypatch to implement default values for NULL using COALESCE is available here: http://stackoverflow.com/questions/553038/treat-null-as-0-in-django-model -- Ticket URL: <http://code.djangoproject.com/ticket/10929> Django <http://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 post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---