From f3da09df0f4147223ab76a00a841586ccf11005d Mon Sep 17 00:00:00 2001 From: Hannes Ljungberg Date: Fri, 20 Mar 2020 23:08:32 +0100 Subject: Fixed #31396 -- Added binary XOR operator to F expressions. --- django/db/models/expressions.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'django/db/models') 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) -- cgit v1.3