diff options
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/expressions.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/ref/models/expressions.txt b/docs/ref/models/expressions.txt index 9ab502d244..d45cfbe00a 100644 --- a/docs/ref/models/expressions.txt +++ b/docs/ref/models/expressions.txt @@ -410,6 +410,14 @@ The ``Aggregate`` API is as follows: allows passing a ``distinct`` keyword argument. If set to ``False`` (default), ``TypeError`` is raised if ``distinct=True`` is passed. + .. attribute:: empty_aggregate_value + + .. versionadded:: 4.0 + + Override :attr:`~django.db.models.Expression.empty_aggregate_value` to + ``None`` since most aggregate functions result in ``NULL`` when applied + to an empty result set. + The ``expressions`` positional arguments can include expressions, transforms of the model field, or the names of model fields. They will be converted to a string and used as the ``expressions`` placeholder within the ``template``. @@ -950,6 +958,15 @@ calling the appropriate methods on the wrapped expression. in :class:`~django.db.models.expressions.Window`. Defaults to ``False``. + .. attribute:: empty_aggregate_value + + .. versionadded:: 4.0 + + Tells Django which value should be returned when the expression is used + to :meth:`aggregate <django.db.models.query.QuerySet.aggregate>` over + an empty result set. Defaults to :py:data:`NotImplemented` which forces + the expression to be computed on the database. + .. method:: resolve_expression(query=None, allow_joins=True, reuse=None, summarize=False, for_save=False) Provides the chance to do any pre-processing or validation of |
