diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2011-07-05 20:16:08 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2011-07-05 20:16:08 +0000 |
| commit | 471a841147ca9bb6a5cae8981be6d66ec42966a0 (patch) | |
| tree | 482da80fbf5729668f71c5a24bcd075d51bd3249 /docs/ref | |
| parent | 8b34a010171d728e3e8c26b04ed46fcb386310c4 (diff) | |
Added another bit to the update() queryset docs about avoiding race conditions
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16517 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/querysets.txt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 68a37ab6fd..aaf6a97a03 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1328,6 +1328,10 @@ memory. The former is more efficient. For example, instead of doing this:: Entry.objects.get(id=10).update(comments_on=False) +Using ``update()`` instead of loading the object into memory also prevents a +race condition where something might change in your database in the short +period of time between loading the object and calling ``save()``. + Finally, note that the ``update()`` method does an update at the SQL level and, thus, does not call any ``save()`` methods on your models, nor does it emit the ``pre_save`` or ``post_save`` signals (which are a consequence of calling |
