@@ -30,7 +30,7 @@ General-purpose aggregation functions
30
30
``ArrayAgg``
31
31
------------
32
32
33
- .. class:: ArrayAgg(expression, distinct=False, filter=None, default=None, ordering =(), **extra)
33
+ .. class:: ArrayAgg(expression, distinct=False, filter=None, default=None, order_by =(), **extra)
34
34
35
35
Returns a list of values, including nulls, concatenated into an array, or
36
36
``default`` if there are no values.
@@ -40,7 +40,9 @@ General-purpose aggregation functions
40
40
An optional boolean argument that determines if array values
41
41
will be distinct. Defaults to ``False``.
42
42
43
- .. attribute:: ordering
43
+ .. attribute:: order_by
44
+
45
+ .. versionadded:: 5.2
44
46
45
47
An optional string of a field name (with an optional ``"-"`` prefix
46
48
which indicates descending order) or an expression (or a tuple or list
@@ -55,6 +57,11 @@ General-purpose aggregation functions
55
57
56
58
F("some_field").desc()
57
59
60
+ .. deprecated:: 5.2
61
+
62
+ The ``ordering`` keyword argument is deprecated. Use
63
+ :attr:`ArrayAgg.order_by` instead.
64
+
58
65
``BitAnd``
59
66
----------
60
67
@@ -130,7 +137,7 @@ General-purpose aggregation functions
130
137
``JSONBAgg``
131
138
------------
132
139
133
- .. class:: JSONBAgg(expressions, distinct=False, filter=None, default=None, ordering =(), **extra)
140
+ .. class:: JSONBAgg(expressions, distinct=False, filter=None, default=None, order_by =(), **extra)
134
141
135
142
Returns the input values as a ``JSON`` array, or ``default`` if there are
136
143
no values. You can query the result using :lookup:`key and index lookups
@@ -141,14 +148,16 @@ General-purpose aggregation functions
141
148
An optional boolean argument that determines if array values will be
142
149
distinct. Defaults to ``False``.
143
150
144
- .. attribute:: ordering
151
+ .. attribute:: order_by
152
+
153
+ .. versionadded:: 5.2
145
154
146
155
An optional string of a field name (with an optional ``"-"`` prefix
147
156
which indicates descending order) or an expression (or a tuple or list
148
157
of strings and/or expressions) that specifies the ordering of the
149
158
elements in the result list.
150
159
151
- Examples are the same as for :attr:`ArrayAgg.ordering `.
160
+ Examples are the same as for :attr:`ArrayAgg.order_by `.
152
161
153
162
Usage example::
154
163
@@ -168,18 +177,23 @@ General-purpose aggregation functions
168
177
>>> Room.objects.annotate(
169
178
... requirements=JSONBAgg(
170
179
... "hotelreservation__requirements",
171
- ... ordering ="-hotelreservation__start",
180
+ ... order_by ="-hotelreservation__start",
172
181
... )
173
182
... ).filter(requirements__0__sea_view=True).values("number", "requirements")
174
183
<QuerySet [{'number': 102, 'requirements': [
175
184
{'parking': False, 'sea_view': True, 'double_bed': False},
176
185
{'parking': True, 'double_bed': True}
177
186
]}]>
178
187
188
+ .. deprecated:: 5.2
189
+
190
+ The ``ordering`` keyword argument is deprecated. Use
191
+ :attr:`JSONBAgg.order_by` instead.
192
+
179
193
``StringAgg``
180
194
-------------
181
195
182
- .. class:: StringAgg(expression, delimiter, distinct=False, filter=None, default=None, ordering =())
196
+ .. class:: StringAgg(expression, delimiter, distinct=False, filter=None, default=None, order_by =())
183
197
184
198
Returns the input values concatenated into a string, separated by
185
199
the ``delimiter`` string, or ``default`` if there are no values.
@@ -193,14 +207,16 @@ General-purpose aggregation functions
193
207
An optional boolean argument that determines if concatenated values
194
208
will be distinct. Defaults to ``False``.
195
209
196
- .. attribute:: ordering
210
+ .. attribute:: order_by
211
+
212
+ .. versionadded:: 5.2
197
213
198
214
An optional string of a field name (with an optional ``"-"`` prefix
199
215
which indicates descending order) or an expression (or a tuple or list
200
216
of strings and/or expressions) that specifies the ordering of the
201
217
elements in the result string.
202
218
203
- Examples are the same as for :attr:`ArrayAgg.ordering `.
219
+ Examples are the same as for :attr:`ArrayAgg.order_by `.
204
220
205
221
Usage example::
206
222
@@ -224,13 +240,18 @@ General-purpose aggregation functions
224
240
... publication_names=StringAgg(
225
241
... "publications__title",
226
242
... delimiter=", ",
227
- ... ordering ="publications__title",
243
+ ... order_by ="publications__title",
228
244
... )
229
245
... ).values("headline", "publication_names")
230
246
<QuerySet [{
231
247
'headline': 'NASA uses Python', 'publication_names': 'Science News, The Python Journal'
232
248
}]>
233
249
250
+ .. deprecated:: 5.2
251
+
252
+ The ``ordering`` keyword argument is deprecated. Use
253
+ :attr:`StringAgg.order_by` instead.
254
+
234
255
Aggregate functions for statistics
235
256
==================================
236
257
0 commit comments