Browse files

Adding an Avg aggregate

  • Loading branch information...
coleifer committed Aug 6, 2012
1 parent 3628fcf commit 1c1b5761d0c767610b23c9a72eef978649a2bb21
Showing with 4 additions and 1 deletion.
  1. +4 −1
@@ -35,7 +35,7 @@
__all__ = [
'ImproperlyConfigured', 'SqliteDatabase', 'MySQLDatabase', 'PostgresqlDatabase',
- 'asc', 'desc', 'Count', 'Max', 'Min', 'Sum', 'Q', 'Field', 'CharField', 'TextField',
+ 'asc', 'desc', 'Count', 'Max', 'Min', 'Sum', 'Avg', 'Q', 'Field', 'CharField', 'TextField',
'DateTimeField', 'BooleanField', 'DecimalField', 'FloatField', 'IntegerField',
'PrimaryKeyField', 'ForeignKeyField', 'DoubleField', 'BigIntegerField', 'Model',
'filter_query', 'annotate_query', 'F', 'R', 'DateField', 'TimeField',
@@ -781,6 +781,9 @@ def Min(f, alias='min'):
def Sum(f, alias='sum'):
return ('SUM', f, alias)
+def Avg(f, alias='avg'):
+ return ('AVG', f, alias)
# decorator for query methods to indicate that they change the state of the
# underlying data structures
def returns_clone(func):

0 comments on commit 1c1b576

Please sign in to comment.