1
0
mirror of https://github.com/django/django.git synced 2025-02-11 09:55:22 +00:00

Fixed #12084 -- Documented the fact that QuerySet.update() returns the number of affected rows. Thanks, timo

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12181 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2010-01-10 18:36:45 +00:00
parent 5ceed0a053
commit 457df03c99

View File

@ -785,8 +785,8 @@ instance you want to point to. Example::
# Change every Entry so that it belongs to this Blog. # Change every Entry so that it belongs to this Blog.
>>> Entry.objects.all().update(blog=b) >>> Entry.objects.all().update(blog=b)
The ``update()`` method is applied instantly and doesn't return anything The ``update()`` method is applied instantly and returns the number of rows
(similar to ``delete()``). The only restriction on the ``QuerySet`` that is affected by the query. The only restriction on the ``QuerySet`` that is
updated is that it can only access one database table, the model's main 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; table. So don't try to filter based on related fields or anything like that;
it won't work. it won't work.