summaryrefslogtreecommitdiff
path: root/django/db/models
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes@5monkeys.se>2020-03-20 23:08:32 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-03-25 10:16:30 +0100
commitf3da09df0f4147223ab76a00a841586ccf11005d (patch)
treee36e8116a5b7abaa453791545a65e3febe3adc87 /django/db/models
parent39e1c88de67ea2035d5ad89cfe00bcd892c0d163 (diff)
Fixed #31396 -- Added binary XOR operator to F expressions.
Diffstat (limited to 'django/db/models')
-rw-r--r--django/db/models/expressions.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py
index 84960d77e1..4753a258f9 100644
--- a/django/db/models/expressions.py
+++ b/django/db/models/expressions.py
@@ -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)