Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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: http://code.djangoproject.com/svn/django/trunk@7884 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 88c17b582194d34e0a96864b7e3153f6de2dd0e1 1 parent 7936c0b
Malcolm Tredinnick authored July 11, 2008

Showing 1 changed file with 12 additions and 0 deletions. Show diff stats Hide diff stats

  1. 12  docs/db-api.txt
12  docs/db-api.txt
@@ -2212,6 +2212,18 @@ updated is that it can only access one database table, the model's main
2212 2212
 table. So don't try to filter based on related fields or anything like that;
2213 2213
 it won't work.
2214 2214
 
  2215
+Be aware that the ``update()`` method is converted directly to an SQL
  2216
+statement. It is a bulk operation for direct updates. It doesn't run any
  2217
+``save()`` methods on your models, or emit the ``pre_save`` or ``post_save``
  2218
+signals (which are a consequence of calling ``save()``). If you want to save
  2219
+every item in a ``QuerySet`` and make sure that the ``save()`` method is
  2220
+called on each instance, you don't need any special function to handle that.
  2221
+Just loop over them and call ``save()``:
  2222
+
  2223
+    for item in my_queryset:
  2224
+        item.save()
  2225
+
  2226
+
2215 2227
 Extra instance methods
2216 2228
 ======================
2217 2229
 

0 notes on commit 88c17b5

Please sign in to comment.
Something went wrong with that request. Please try again.