diff --git a/django/db/models/sql/aggregates.py b/django/db/models/sql/aggregates.py
index b31e11d..b1213a7 100644
a
|
b
|
class Aggregate(object):
|
7 | 7 | """ |
8 | 8 | Default SQL Aggregate. |
9 | 9 | """ |
| 10 | is_ordinal = False |
| 11 | is_computed = False |
| 12 | sql_template = '%(function)s(%(field)s)' |
| 13 | |
10 | 14 | def __init__(self, function, lookup, **extra): |
11 | 15 | self.sql_function = function |
12 | 16 | self.lookup = lookup |
13 | 17 | self.extra = extra |
14 | | self.is_ordinal = False |
15 | | self.is_computed = False |
16 | | self.sql_template = '%(function)s(%(field)s)' |
17 | 18 | |
18 | 19 | def get_internal_type(self): |
19 | 20 | "Return the internal data type of the field being aggregated" |
… |
… |
class Min(Aggregate):
|
53 | 54 | super(Min, self).__init__('MIN', lookup) |
54 | 55 | |
55 | 56 | class Avg(Aggregate): |
| 57 | is_computed = True |
| 58 | |
56 | 59 | def __init__(self, lookup): |
57 | 60 | super(Avg, self).__init__('AVG', lookup) |
58 | | self.is_computed = True |
| 61 | |
59 | 62 | |
60 | 63 | class Sum(Aggregate): |
61 | 64 | def __init__(self, lookup): |
62 | 65 | super(Sum, self).__init__('SUM', lookup) |
63 | 66 | |
64 | 67 | class Count(Aggregate): |
| 68 | is_ordinal = True |
| 69 | sql_template = '%(function)s(%(distinct)s%(field)s)' |
| 70 | |
65 | 71 | def __init__(self, lookup, distinct=False): |
66 | 72 | super(Count, self).__init__('COUNT', lookup, distinct=distinct and 'DISTINCT ' or '') |
67 | | self.sql_template = '%(function)s(%(distinct)s%(field)s)' |
68 | | self.is_ordinal = True |
| 73 | |