From f9bf616597d56deac66d9d6bb753b028dd9634cc Mon Sep 17 00:00:00 2001 From: Flavio Curella <89607+fcurella@users.noreply.github.com> Date: Tue, 23 Jul 2024 09:36:26 -0500 Subject: [PATCH] Fixed #35585 -- Corrected Query.exists() call in Query.has_results(). --- django/db/models/sql/query.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index f00eb1e5a5..9a57af2bf3 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -650,13 +650,13 @@ class Query(BaseExpression): for combined_query in q.combined_queries ) q.clear_ordering(force=True) - if limit: + if limit is True: q.set_limits(high=1) q.add_annotation(Value(1), "a") return q def has_results(self, using): - q = self.exists(using) + q = self.exists() compiler = q.get_compiler(using=using) return compiler.has_results()