summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2013-02-21 23:02:18 +0100
committerTim Graham <timograham@gmail.com>2013-10-22 10:29:57 -0400
commit5240b83462ba4887b67da8d493dfdc23fec5df97 (patch)
tree7bae13c499bc84b5f4bcf79c592aa2a9b8008033 /docs
parent1597503a017a9ced422a81d314cb4097d53c3dfd (diff)
Fixed #17027 -- Added support for the power operator in F expressions.
Thanks dan at dlo.me for the initial patch. - Added __pow__ and __rpow__ to ExpressionNode - Added oracle and mysql specific power expressions - Added used-defined power function for sqlite
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/queries.txt4
-rw-r--r--docs/releases/1.7.txt3
-rw-r--r--docs/topics/db/queries.txt6
3 files changed, 12 insertions, 1 deletions
diff --git a/docs/ref/models/queries.txt b/docs/ref/models/queries.txt
index ebc5142b30..bf7480ef69 100644
--- a/docs/ref/models/queries.txt
+++ b/docs/ref/models/queries.txt
@@ -112,6 +112,10 @@ As well as addition, Django supports subtraction, multiplication, division,
and modulo arithmetic with ``F()`` objects, using Python constants,
variables, and even other ``F()`` objects.
+.. versionadded:: 1.7
+
+ The power operator ``**`` is also supported.
+
``Q()`` objects
===============
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index 699566f1d3..542efc46b9 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -346,6 +346,9 @@ Models
:attr:`~django.db.models.ForeignKey.related_name` to
`'+'` or ending it with `'+'`.
+* :class:`F expressions <django.db.models.F>` support the power operator
+ (``**``).
+
Signals
^^^^^^^
diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt
index 1180022d6e..7b38dbaea3 100644
--- a/docs/topics/db/queries.txt
+++ b/docs/topics/db/queries.txt
@@ -610,12 +610,16 @@ and use that ``F()`` object in the query::
>>> Entry.objects.filter(n_comments__gt=F('n_pingbacks'))
Django supports the use of addition, subtraction, multiplication,
-division and modulo arithmetic with ``F()`` objects, both with constants
+division, modulo, and power arithmetic with ``F()`` objects, both with constants
and with other ``F()`` objects. To find all the blog entries with more than
*twice* as many comments as pingbacks, we modify the query::
>>> Entry.objects.filter(n_comments__gt=F('n_pingbacks') * 2)
+.. versionadded:: 1.7
+
+ The power operator ``**`` was added.
+
To find all the entries where the rating of the entry is less than the
sum of the pingback count and comment count, we would issue the
query::