diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2012-09-30 17:51:06 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2012-09-30 17:51:06 +0300 |
| commit | 28abf5f0ebc9d380f25dd278d7ef4642c4504545 (patch) | |
| tree | 6ec2caaaec8576660780adeb22d6dd09f5ef84d4 /docs | |
| parent | ddd7d1af203d6d260c970d8ee8749fedbce6bba1 (diff) | |
Fixed #16211 -- Added comparison and negation ops to F() expressions
Work done by Walter Doekes and Trac alias knoeb. Reviewed by Simon
Charette.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/1.5.txt | 4 | ||||
| -rw-r--r-- | docs/topics/db/queries.txt | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/docs/releases/1.5.txt b/docs/releases/1.5.txt index 367b4f8349..b371214994 100644 --- a/docs/releases/1.5.txt +++ b/docs/releases/1.5.txt @@ -176,6 +176,10 @@ Django 1.5 also includes several smaller improvements worth noting: :setting:`DEBUG` is `True` are sent to the console (unless you redefine the logger in your :setting:`LOGGING` setting). +* :ref:`F() expressions <query-expressions>` now support comparison operations + and inversion, expanding the types of expressions that can be passed to the + database. + Backwards incompatible changes in 1.5 ===================================== diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt index dd160656c7..c724eabb8e 100644 --- a/docs/topics/db/queries.txt +++ b/docs/topics/db/queries.txt @@ -640,6 +640,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)) +.. versionadded:: 1.5 + Comparisons and negation operators for ``F()`` expressions + +Django also supports the comparison operators ``==``, ``!=``, ``<=``, ``<``, +``>``, ``>=`` and the bitwise negation operator ``~`` (boolean ``not`` operator +will raise ``TypeError``):: + + >>> Entry.objects.filter(is_heavily_quoted=~(F('n_pingbacks') < 100)) + The pk lookup shortcut ---------------------- |
