summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authormgaligniana <marcelogaligniana@gmail.com>2022-04-11 09:25:26 -0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-04-12 08:18:22 +0200
commit0ad5316f22eabe8fa8b22dc92e61170cfacc3c78 (patch)
tree93fb5aeda702eee5be994d73bc8324fb7f2a9520 /django/db/models/sql/query.py
parentd2263b7b87a2af5dcd6964937b157b7e1cf2881f (diff)
Fixed #24296 -- Made QuerySet.exists() clear selected columns for not sliced distinct querysets.
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index a55eb84a17..64e7927f7a 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -562,7 +562,7 @@ class Query(BaseExpression):
def exists(self, using, limit=True):
q = self.clone()
- if not q.distinct:
+ if not (q.distinct and q.is_sliced):
if q.group_by is True:
q.add_fields(
(f.attname for f in self.model._meta.concrete_fields), False