Ticket #23386: diff.txt

File diff.txt, 840 bytes (added by codefisher, 10 years ago)

Adding the needed note into the documentation

Line 
1diff --git a/docs/ref/models/queries.txt b/docs/ref/models/queries.txt
2index 1eab21c..c01bc79 100644
3--- a/docs/ref/models/queries.txt
4+++ b/docs/ref/models/queries.txt
5@@ -57,6 +57,18 @@ and describe the operation.
6
7 reporter = Reporters.objects.get(pk=reporter.pk)
8
9+.. note::
10+
11+ The ``F()`` is applied everytime the ``save()`` method gets called.
12+
13+ reporter.stories_filed = F('stories_filed') + 1
14+ reporter.save()
15+ # other changes
16+ reporter.save()
17+
18+ The above would cause ``reporter.stories_filed`` to be incrimented twice,
19+ once for each call to ``save()``
20+
21 As well as being used in operations on single instances as above, ``F()`` can
22 be used on ``QuerySets`` of object instances, with ``update()``. This reduces
23 the two queries we were using above - the ``get()`` and the
Back to Top