diff options
| author | Tim Graham <timograham@gmail.com> | 2015-04-23 20:13:24 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-04-25 13:06:14 -0400 |
| commit | 2d76b61dc2a45d5acda53736433a22a1b74e0514 (patch) | |
| tree | 011da8312505dafe39699748c43f7db8cb66d5fa /docs/ref | |
| parent | 26996e2d55719deb0a0b85c642c88658c929106c (diff) | |
Fixed #24649 -- Allowed using Avg aggregate on non-numeric field types.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/querysets.txt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 3dc66f631a..d2cbc63203 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -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 ~~~~~ |
