diff --git a/django/contrib/postgres/aggregates/statistics.py b/django/contrib/postgres/aggregates/statistics.py index 5f5ddc4757a..db6c8e6dc5d 100644 --- a/django/contrib/postgres/aggregates/statistics.py +++ b/django/contrib/postgres/aggregates/statistics.py @@ -42,9 +42,7 @@ class RegrCount(StatAggregate): output_field = IntegerField() def convert_value(self, value, expression, connection): - if value is None: - return 0 - return int(value) + return 0 if value is None else value class RegrIntercept(StatAggregate): diff --git a/django/db/models/aggregates.py b/django/db/models/aggregates.py index b70ea03838f..365a885b53a 100644 --- a/django/db/models/aggregates.py +++ b/django/db/models/aggregates.py @@ -125,9 +125,7 @@ class Count(Aggregate): return dict(options, distinct=self.extra['distinct'] != '') def convert_value(self, value, expression, connection): - if value is None: - return 0 - return int(value) + return 0 if value is None else value class Max(Aggregate):