Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding an Avg aggregate

  • Loading branch information...
commit 1c1b5761d0c767610b23c9a72eef978649a2bb21 1 parent 3628fcf
@coleifer authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 peewee.py
View
5 peewee.py
@@ -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):
Please sign in to comment.
Something went wrong with that request. Please try again.