MCPcopy
hub / github.com/django/django / _combine

Method _combine

django/db/models/query_utils.py:74–85  ·  view source on GitHub ↗
(self, other, conn)

Source from the content-addressed store, hash-verified

72 raise ValueError(f"connector must be one of {connector_reprs}, or None.")
73
74 def _combine(self, other, conn):
75 if getattr(other, "conditional", False) is False:
76 raise TypeError(other)
77 if not self:
78 return other.copy()
79 if not other and isinstance(other, Q):
80 return self.copy()
81
82 obj = self.create(connector=conn)
83 obj.add(self, conn)
84 obj.add(other, conn)
85 return obj
86
87 def __or__(self, other):
88 return self._combine(other, self.OR)

Callers 3

__or__Method · 0.95
__and__Method · 0.95
__xor__Method · 0.95

Calls 3

createMethod · 0.95
copyMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected