Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

[1.4.X] Fixed #17435 - Clarified that QuerySet.update returns the num…

…ber of rows matched

Backport of 6d46c74 from master
  • Loading branch information...
1 parent 0636c95 commit c06b724a00236b086a5a64510d8bf11978f083f8 @timgraham timgraham committed
Showing with 4 additions and 2 deletions.
  1. +2 −1  docs/ref/models/querysets.txt
  2. +2 −1  docs/topics/db/queries.txt
3  docs/ref/models/querysets.txt
@@ -1530,7 +1530,8 @@ update
.. method:: update(**kwargs)
Performs an SQL update query for the specified fields, and returns
-the number of rows affected.
+the number of rows matched (which may not be equal to the number of rows
+updated if some rows already have the new value).
For example, to turn comments off for all blog entries published in 2010,
you could do this::
3  docs/topics/db/queries.txt
@@ -953,7 +953,8 @@ new value to be the new model instance you want to point to. For example::
>>> Entry.objects.all().update(blog=b)
The ``update()`` method is applied instantly and returns the number of rows
-affected by the query. The only restriction on the
+matched by the query (which may not be equal to the number of rows updated if
+some rows already have the new value). The only restriction on the
:class:`~django.db.models.query.QuerySet` that is updated is that it can only
access one database table, the model's main table. You can filter based on
related fields, but you can only update columns in the model's main

0 comments on commit c06b724

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