summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2021-10-06 01:25:17 -0400
committerGitHub <noreply@github.com>2021-10-06 07:25:17 +0200
commit0f3e1a54bfa19f034f88bf3c25c67402d19e906c (patch)
treeb46e775cac3d635ba17aaf394585039a89e5fea0 /django/db/models/sql/query.py
parent604df4e0adc71da264f61fe85020a170c98e6f09 (diff)
Refs #26430 -- Removed unused branch in sql.Query.get_count().
Now that sql.Query.get_aggregation() properly deals with empty result sets summary Count() annotations cannot result in None. Unused since 9f3cce172f6913c5ac74272fa5fc07f847b4e112.
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index b02d19071b..79499b2854 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -513,10 +513,7 @@ class Query(BaseExpression):
"""
obj = self.clone()
obj.add_annotation(Count('*'), alias='__count', is_summary=True)
- number = obj.get_aggregation(using, ['__count'])['__count']
- if number is None:
- number = 0
- return number
+ return obj.get_aggregation(using, ['__count'])['__count']
def has_filters(self):
return self.where