Author: mtredinnick Date: 2008-07-11 05:03:04 -0500 (Fri, 11 Jul 2008) New Revision: 7884
Modified: django/trunk/docs/db-api.txt Log: Documented that the update() method on querysets is a direct SQL call, not the same as looping over the queryset and calling save() on each item (which is less efficient). Fixed #7447. Modified: django/trunk/docs/db-api.txt =================================================================== --- django/trunk/docs/db-api.txt 2008-07-11 09:00:35 UTC (rev 7883) +++ django/trunk/docs/db-api.txt 2008-07-11 10:03:04 UTC (rev 7884) @@ -2212,6 +2212,18 @@ table. So don't try to filter based on related fields or anything like that; it won't work. +Be aware that the ``update()`` method is converted directly to an SQL +statement. It is a bulk operation for direct updates. It doesn't run any +``save()`` methods on your models, or emit the ``pre_save`` or ``post_save`` +signals (which are a consequence of calling ``save()``). If you want to save +every item in a ``QuerySet`` and make sure that the ``save()`` method is +called on each instance, you don't need any special function to handle that. +Just loop over them and call ``save()``: + + for item in my_queryset: + item.save() + + Extra instance methods ====================== --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---
