Ticket #12084: 12084.diff

File 12084.diff, 1.1 KB (added by timo, 5 years ago)
  • docs/topics/db/queries.txt

     
    785785    # Change every Entry so that it belongs to this Blog.
    786786    >>> Entry.objects.all().update(blog=b)
    787787
    788 The ``update()`` method is applied instantly and doesn't return anything
    789 (similar to ``delete()``). The only restriction on the ``QuerySet`` that is
    790 updated is that it can only access one database table, the model's main
    791 table. So don't try to filter based on related fields or anything like that;
    792 it won't work.
     788The ``update()`` method is applied instantly and returns the number of rows
     789affected by the query. The only restriction on the ``QuerySet`` that is updated
     790is that it can only access one database table, the model's main table. So don't
     791try to filter based on related fields or anything like that; it won't work.
    793792
    794793Be aware that the ``update()`` method is converted directly to an SQL
    795794statement. It is a bulk operation for direct updates. It doesn't run any
Back to Top