From 2d76b61dc2a45d5acda53736433a22a1b74e0514 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 23 Apr 2015 20:13:24 -0400 Subject: Fixed #24649 -- Allowed using Avg aggregate on non-numeric field types. --- docs/ref/models/querysets.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'docs/ref/models') 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: ``__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 ~~~~~ -- cgit v1.3