summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-02-19 22:45:48 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-02-19 22:45:48 +0000
commit322a6a9d1dffee284bb9ea1b309e64f7fa7411b5 (patch)
tree2bf0220eccb0d0476c23c8348019d4d13d0df7aa
parentfc02370ceed1cceb039e1318d0bb00c699f97b01 (diff)
Fixed #10303 -- Corrected a contradiction in the docs regarding the capabilities of the .update() clause that was introduced by the documentation for F() expressions. Thanks to gluckj for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9846 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--docs/topics/db/queries.txt6
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/topics/db/queries.txt b/docs/topics/db/queries.txt
index c54039efa0..b58d955a74 100644
--- a/docs/topics/db/queries.txt
+++ b/docs/topics/db/queries.txt
@@ -767,9 +767,7 @@ a ``QuerySet``. You can do this with the ``update()`` method. For example::
Entry.objects.filter(pub_date__year=2007).update(headline='Everything is the same')
You can only set non-relation fields and ``ForeignKey`` fields using this
-method, and the value you set the field to must be a hard-coded Python value
-(i.e., you can't set a field to be equal to some other field at the moment).
-
+method. To update a non-relation field, provide the new value as a constant.
To update ``ForeignKey`` fields, set the new value to be the new model
instance you want to point to. Example::
@@ -795,6 +793,8 @@ Just loop over them and call ``save()``::
for item in my_queryset:
item.save()
+.. versionadded:: 1.1
+
Calls to update can also use :ref:`F() objects <query-expressions>` to update
one field based on the value of another field in the model. This is especially
useful for incrementing counters based upon their current value. For example, to