summaryrefslogtreecommitdiff
path: root/django/db/models/aggregates.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-07-08 10:39:54 +1000
committerAlex Gaynor <alex.gaynor@gmail.com>2013-07-08 10:39:54 +1000
commit03d9566e0df45c72bffa99fe244a92f0279da56f (patch)
treeb4c9cc9260769d7f79f62c0fe16a2c5a5746e6ed /django/db/models/aggregates.py
parent0b69a755029f8a8ba6005b9d77be8132a7bc0fb3 (diff)
downloaddjango-03d9566e0df45c72bffa99fe244a92f0279da56f.tar.gz
A large number of stylistic cleanups across django/db/
Diffstat (limited to 'django/db/models/aggregates.py')
-rw-r--r--django/db/models/aggregates.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/django/db/models/aggregates.py b/django/db/models/aggregates.py
index b89db1c563..1db3890204 100644
--- a/django/db/models/aggregates.py
+++ b/django/db/models/aggregates.py
@@ -3,6 +3,7 @@ Classes to represent the definitions of aggregate functions.
"""
from django.db.models.constants import LOOKUP_SEP
+
def refs_aggregate(lookup_parts, aggregates):
"""
A little helper method to check if the lookup_parts contains references
@@ -15,6 +16,7 @@ def refs_aggregate(lookup_parts, aggregates):
return True
return False
+
class Aggregate(object):
"""
Default Aggregate definition.
@@ -58,23 +60,30 @@ class Aggregate(object):
aggregate = klass(col, source=source, is_summary=is_summary, **self.extra)
query.aggregates[alias] = aggregate
+
class Avg(Aggregate):
name = 'Avg'
+
class Count(Aggregate):
name = 'Count'
+
class Max(Aggregate):
name = 'Max'
+
class Min(Aggregate):
name = 'Min'
+
class StdDev(Aggregate):
name = 'StdDev'
+
class Sum(Aggregate):
name = 'Sum'
+
class Variance(Aggregate):
name = 'Variance'