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:
committed by
Mariusz Felisiak
parent
39e1c88de6
commit
f3da09df0f
@@ -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
|
||||
~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -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
|
||||
--------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user