mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #24649 -- Allowed using Avg aggregate on non-numeric field types.
This commit is contained in:
@@ -2802,12 +2802,19 @@ by the aggregate.
|
||||
Avg
|
||||
~~~
|
||||
|
||||
.. class:: Avg(expression, output_field=None, **extra)
|
||||
.. class:: Avg(expression, output_field=FloatField(), **extra)
|
||||
|
||||
Returns the mean value of the given expression, which must be numeric.
|
||||
Returns the mean value of the given expression, which must be numeric
|
||||
unless you specify a different ``output_field``.
|
||||
|
||||
* Default alias: ``<field>__avg``
|
||||
* Return type: ``float``
|
||||
* Return type: ``float`` (or the type of whatever ``output_field`` is
|
||||
specified)
|
||||
|
||||
.. versionchanged:: 1.9
|
||||
|
||||
The ``output_field`` parameter was added to allow aggregating over
|
||||
non-numeric columns, such as ``DurationField``.
|
||||
|
||||
Count
|
||||
~~~~~
|
||||
|
||||
Reference in New Issue
Block a user