Browse files

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.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
malcolmt committed Jul 11, 2008
1 parent 7936c0b commit 88c17b582194d34e0a96864b7e3153f6de2dd0e1
Showing with 12 additions and 0 deletions.
  1. +12 −0 docs/db-api.txt
@@ -2212,6 +2212,18 @@ updated is that it can only access one database table, the model's main
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:
Extra instance methods

0 comments on commit 88c17b5

Please sign in to comment.