From 96199e562dcc409ab4bdc2b2146fa7cf73c7c5fe Mon Sep 17 00:00:00 2001 From: Floris den Hengst Date: Tue, 5 Jul 2016 11:47:24 +0200 Subject: Fixed #26067 -- Added ordering support to ArrayAgg and StringAgg. --- docs/ref/contrib/postgres/aggregates.txt | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'docs/ref') diff --git a/docs/ref/contrib/postgres/aggregates.txt b/docs/ref/contrib/postgres/aggregates.txt index 480c230c40..a605bc831c 100644 --- a/docs/ref/contrib/postgres/aggregates.txt +++ b/docs/ref/contrib/postgres/aggregates.txt @@ -22,7 +22,7 @@ General-purpose aggregation functions ``ArrayAgg`` ------------ -.. class:: ArrayAgg(expression, distinct=False, filter=None, **extra) +.. class:: ArrayAgg(expression, distinct=False, filter=None, ordering=(), **extra) Returns a list of values, including nulls, concatenated into an array. @@ -31,6 +31,22 @@ General-purpose aggregation functions An optional boolean argument that determines if array values will be distinct. Defaults to ``False``. + .. attribute:: ordering + + .. versionadded:: 2.2 + + An optional string of a field name (with an optional ``"-"`` prefix + which indicates descending order) or an expression (or a tuple or list + of strings and/or expressions) that specifies the ordering of the + elements in the result list. + + Examples:: + + 'some_field' + '-some_field' + from django.db.models import F + F('some_field').desc() + ``BitAnd`` ---------- @@ -73,7 +89,7 @@ General-purpose aggregation functions ``StringAgg`` ------------- -.. class:: StringAgg(expression, delimiter, distinct=False, filter=None) +.. class:: StringAgg(expression, delimiter, distinct=False, filter=None, ordering=()) Returns the input values concatenated into a string, separated by the ``delimiter`` string. @@ -87,6 +103,17 @@ General-purpose aggregation functions An optional boolean argument that determines if concatenated values will be distinct. Defaults to ``False``. + .. attribute:: ordering + + .. versionadded:: 2.2 + + An optional string of a field name (with an optional ``"-"`` prefix + which indicates descending order) or an expression (or a tuple or list + of strings and/or expressions) that specifies the ordering of the + elements in the result string. + + Examples are the same as for :attr:`ArrayAgg.ordering`. + Aggregate functions for statistics ================================== -- cgit v1.3