summaryrefslogtreecommitdiff
path: root/django/contrib/postgres
diff options
context:
space:
mode:
Diffstat (limited to 'django/contrib/postgres')
-rw-r--r--django/contrib/postgres/aggregates/statistics.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/django/contrib/postgres/aggregates/statistics.py b/django/contrib/postgres/aggregates/statistics.py
index b9a8ba07c5..19f26ec53c 100644
--- a/django/contrib/postgres/aggregates/statistics.py
+++ b/django/contrib/postgres/aggregates/statistics.py
@@ -8,10 +8,10 @@ __all__ = [
class StatAggregate(Aggregate):
- def __init__(self, y, x, output_field=FloatField()):
+ def __init__(self, y, x, output_field=FloatField(), filter=None):
if not x or not y:
raise ValueError('Both y and x must be provided.')
- super().__init__(y, x, output_field=output_field)
+ super().__init__(y, x, output_field=output_field, filter=filter)
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
return super().resolve_expression(query, allow_joins, reuse, summarize)
@@ -22,9 +22,9 @@ class Corr(StatAggregate):
class CovarPop(StatAggregate):
- def __init__(self, y, x, sample=False):
+ def __init__(self, y, x, sample=False, filter=None):
self.function = 'COVAR_SAMP' if sample else 'COVAR_POP'
- super().__init__(y, x)
+ super().__init__(y, x, filter=filter)
class RegrAvgX(StatAggregate):
@@ -38,8 +38,8 @@ class RegrAvgY(StatAggregate):
class RegrCount(StatAggregate):
function = 'REGR_COUNT'
- def __init__(self, y, x):
- super().__init__(y=y, x=x, output_field=IntegerField())
+ def __init__(self, y, x, filter=None):
+ super().__init__(y=y, x=x, output_field=IntegerField(), filter=filter)
def convert_value(self, value, expression, connection):
if value is None: