mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
Fixed #32116 -- Fixed QuerySet.order_by() crash on EmptyQuerySet with union() on a single non-empty ordered queryset.
This commit is contained in:
committed by
Mariusz Felisiak
parent
4e4db426c5
commit
c7c7615d00
@@ -995,7 +995,11 @@ class QuerySet:
|
||||
# If the query is an EmptyQuerySet, combine all nonempty querysets.
|
||||
if isinstance(self, EmptyQuerySet):
|
||||
qs = [q for q in other_qs if not isinstance(q, EmptyQuerySet)]
|
||||
return qs[0]._combinator_query('union', *qs[1:], all=all) if qs else self
|
||||
if not qs:
|
||||
return self
|
||||
if len(qs) == 1:
|
||||
return qs[0]
|
||||
return qs[0]._combinator_query('union', *qs[1:], all=all)
|
||||
return self._combinator_query('union', *other_qs, all=all)
|
||||
|
||||
def intersection(self, *other_qs):
|
||||
|
||||
Reference in New Issue
Block a user