1
0
mirror of https://github.com/django/django.git synced 2025-01-03 15:06:09 +00:00

Fixed #35585 -- Corrected Query.exists() call in Query.has_results().

This commit is contained in:
Flavio Curella 2024-07-23 09:36:26 -05:00 committed by GitHub
parent fb7be022cb
commit f9bf616597
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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()