MCPcopy
hub / github.com/django/django / __or__

Method __or__

django/db/models/query.py:503–520  ·  view source on GitHub ↗
(self, other)

Source from the content-addressed store, hash-verified

501 return combined
502
503 def __or__(self, other):
504 self._check_operator_queryset(other, "|")
505 self._merge_sanity_check(other)
506 if isinstance(self, EmptyQuerySet):
507 return other
508 if isinstance(other, EmptyQuerySet):
509 return self
510 query = (
511 self
512 if self.query.can_filter()
513 else self.model._base_manager.filter(pk__in=self.values("pk"))
514 )
515 combined = query._chain()
516 combined._merge_known_related_objects(other)
517 if not other.query.can_filter():
518 other = other.model._base_manager.filter(pk__in=other.values("pk"))
519 combined.query.combine(other.query, sql.OR)
520 return combined
521
522 def __xor__(self, other):
523 self._check_operator_queryset(other, "^")

Callers

nothing calls this directly

Calls 8

_merge_sanity_checkMethod · 0.95
valuesMethod · 0.95
can_filterMethod · 0.80
_chainMethod · 0.80
combineMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected