db.models.Avg

class Avg(expression, output_field=FloatField(), **extra) [source]

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 (or the type of whatever output_field is specified)
Changed in Django 1.9:

The output_field parameter was added to allow aggregating over non-numeric columns, such as DurationField.

doc_Django
2016-10-09 18:35:12
Comments
Leave a Comment

Please login to continue.