| 1710 | return clone |
| 1711 | |
| 1712 | def union(self, *other_qs, all=False): |
| 1713 | # If the query is an EmptyQuerySet, combine all nonempty querysets. |
| 1714 | if isinstance(self, EmptyQuerySet): |
| 1715 | qs = [q for q in other_qs if not isinstance(q, EmptyQuerySet)] |
| 1716 | if not qs: |
| 1717 | return self |
| 1718 | if len(qs) == 1: |
| 1719 | return qs[0] |
| 1720 | return qs[0]._combinator_query("union", *qs[1:], all=all) |
| 1721 | elif not other_qs: |
| 1722 | return self |
| 1723 | return self._combinator_query("union", *other_qs, all=all) |
| 1724 | |
| 1725 | def intersection(self, *other_qs): |
| 1726 | # If any query is an EmptyQuerySet, return it. |