Author: russellm Date: 2009-02-19 16:45:48 -0600 (Thu, 19 Feb 2009) New Revision: 9846
Modified: django/trunk/docs/topics/db/queries.txt Log: 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. Modified: django/trunk/docs/topics/db/queries.txt =================================================================== --- django/trunk/docs/topics/db/queries.txt 2009-02-17 23:33:30 UTC (rev 9845) +++ django/trunk/docs/topics/db/queries.txt 2009-02-19 22:45:48 UTC (rev 9846) @@ -767,9 +767,7 @@ 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 @@ 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---