mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #17930 -- Allowed ORing (|) with sliced QuerySets.
This commit is contained in:
parent
cd40306854
commit
e1fc07c047
2 changed files with 35 additions and 1 deletions
|
@ -327,8 +327,11 @@ class QuerySet:
|
|||
return other
|
||||
if isinstance(other, EmptyQuerySet):
|
||||
return self
|
||||
combined = self._chain()
|
||||
query = self if self.query.can_filter() else self.model._base_manager.filter(pk__in=self.values('pk'))
|
||||
combined = query._chain()
|
||||
combined._merge_known_related_objects(other)
|
||||
if not other.query.can_filter():
|
||||
other = other.model._base_manager.filter(pk__in=other.values('pk'))
|
||||
combined.query.combine(other.query, sql.OR)
|
||||
return combined
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue