Inlined a note in docs/ref/models/expressions.txt.
This commit is contained in:
parent
f8fab6f902
commit
0d6c7cae7c
|
@ -119,14 +119,11 @@ know about it - it is dealt with entirely by the database. All Python does,
|
||||||
through Django's ``F()`` class, is create the SQL syntax to refer to the field
|
through Django's ``F()`` class, is create the SQL syntax to refer to the field
|
||||||
and describe the operation.
|
and describe the operation.
|
||||||
|
|
||||||
.. note::
|
To access the new value saved this way, the object must be reloaded::
|
||||||
|
|
||||||
In order to access the new value that has been saved in this way, the object
|
reporter = Reporters.objects.get(pk=reporter.pk)
|
||||||
will need to be reloaded::
|
# Or, more succinctly:
|
||||||
|
reporter.refresh_from_db()
|
||||||
reporter = Reporters.objects.get(pk=reporter.pk)
|
|
||||||
# Or, more succinctly:
|
|
||||||
reporter.refresh_from_db()
|
|
||||||
|
|
||||||
As well as being used in operations on single instances as above, ``F()`` can
|
As well as being used in operations on single instances as above, ``F()`` can
|
||||||
be used on ``QuerySets`` of object instances, with ``update()``. This reduces
|
be used on ``QuerySets`` of object instances, with ``update()``. This reduces
|
||||||
|
|
Loading…
Reference in New Issue