1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #31396 -- Added binary XOR operator to F expressions.

This commit is contained in:
Hannes Ljungberg
2020-03-20 23:08:32 +01:00
committed by Mariusz Felisiak
parent 39e1c88de6
commit f3da09df0f
8 changed files with 44 additions and 4 deletions

View File

@@ -338,6 +338,9 @@ Models
* The new ``is_dst`` parameter of the :meth:`.QuerySet.datetimes` determines
the treatment of nonexistent and ambiguous datetimes.
* The new :class:`~django.db.models.F` expression ``bitxor()`` method allows
:ref:`bitwise XOR operation <using-f-expressions-in-filters>`.
Pagination
~~~~~~~~~~

View File

@@ -656,10 +656,18 @@ that were modified more than 3 days after they were published::
>>> Entry.objects.filter(mod_date__gt=F('pub_date') + timedelta(days=3))
The ``F()`` objects support bitwise operations by ``.bitand()``, ``.bitor()``,
``.bitrightshift()``, and ``.bitleftshift()``. For example::
``.bitxor()``, ``.bitrightshift()``, and ``.bitleftshift()``. For example::
>>> F('somefield').bitand(16)
.. admonition:: Oracle
Oracle doesn't support bitwise XOR operation.
.. versionchanged:: 3.1
Support for ``.bitxor()`` was added.
The ``pk`` lookup shortcut
--------------------------