mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #24649 -- Allowed using Avg aggregate on non-numeric field types.
This commit is contained in:
parent
26996e2d55
commit
2d76b61dc2
7 changed files with 46 additions and 15 deletions
|
@ -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
|
||||
~~~~~
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue