mirror of
https://github.com/django/django.git
synced 2025-08-31 07:47:37 +00:00
Fixed #29118 -- Fixed crash with QuerySet.order_by(Exists(...)).
This commit is contained in:
parent
1a1264f149
commit
bf26f66029
3 changed files with 14 additions and 6 deletions
|
@ -1041,11 +1041,11 @@ class Exists(Subquery):
|
|||
def __invert__(self):
|
||||
return type(self)(self.queryset, negated=(not self.negated), **self.extra)
|
||||
|
||||
def resolve_expression(self, query=None, **kwargs):
|
||||
def resolve_expression(self, query=None, *args, **kwargs):
|
||||
# As a performance optimization, remove ordering since EXISTS doesn't
|
||||
# care about it, just whether or not a row matches.
|
||||
self.queryset = self.queryset.order_by()
|
||||
return super().resolve_expression(query, **kwargs)
|
||||
return super().resolve_expression(query, *args, **kwargs)
|
||||
|
||||
def as_sql(self, compiler, connection, template=None, **extra_context):
|
||||
sql, params = super().as_sql(compiler, connection, template, **extra_context)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue