mirror of
https://github.com/django/django.git
synced 2025-08-25 21:14:44 +00:00
Fixed #31396 -- Added binary XOR operator to F expressions.
This commit is contained in:
parent
39e1c88de6
commit
f3da09df0f
8 changed files with 44 additions and 4 deletions
|
@ -51,6 +51,7 @@ class Combinable:
|
|||
BITOR = '|'
|
||||
BITLEFTSHIFT = '<<'
|
||||
BITRIGHTSHIFT = '>>'
|
||||
BITXOR = '#'
|
||||
|
||||
def _combine(self, other, connector, reversed):
|
||||
if not hasattr(other, 'resolve_expression'):
|
||||
|
@ -105,6 +106,9 @@ class Combinable:
|
|||
def bitrightshift(self, other):
|
||||
return self._combine(other, self.BITRIGHTSHIFT, False)
|
||||
|
||||
def bitxor(self, other):
|
||||
return self._combine(other, self.BITXOR, False)
|
||||
|
||||
def __or__(self, other):
|
||||
if getattr(self, 'conditional', False) and getattr(other, 'conditional', False):
|
||||
return Q(self) | Q(other)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue