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

Fixed #25912 -- Added binary left/right shift operators to F expressions.

Thanks Mariusz Felisiak for review and MySQL advice.
This commit is contained in:
anabelensc
2015-12-14 19:13:21 +00:00
committed by Tim Graham
parent f0ef0c49e9
commit 1c12df4aa6
7 changed files with 37 additions and 5 deletions

View File

@@ -652,11 +652,15 @@ that were modified more than 3 days after they were published::
>>> from datetime import timedelta
>>> Entry.objects.filter(mod_date__gt=F('pub_date') + timedelta(days=3))
The ``F()`` objects support bitwise operations by ``.bitand()`` and
``.bitor()``, for example::
The ``F()`` objects support bitwise operations by ``.bitand()``, ``.bitor()``,
``.bitrightshift()``, and ``.bitleftshift()``. For example::
>>> F('somefield').bitand(16)
.. versionchanged:: 1.11
Support for ``.bitrightshift()`` and ``.bitleftshift()`` was added.
The ``pk`` lookup shortcut
--------------------------