django1/django/db
Loic Bistuer 17c3997f68 Fixed #21169 -- Reworked RelatedManager methods use default filtering
The `remove()` and `clear()` methods of the related managers created by
`ForeignKey`, `GenericForeignKey`, and `ManyToManyField` suffered from a
number of issues. Some operations ran multiple data modifying queries without
wrapping them in a transaction, and some operations didn't respect default
filtering when it was present (i.e. when the default manager on the related
model implemented a custom `get_queryset()`).

Fixing the issues introduced some backward incompatible changes:

- The implementation of `remove()` for `ForeignKey` related managers changed
  from a series of `Model.save()` calls to a single `QuerySet.update()` call.
  The change means that `pre_save` and `post_save` signals aren't called anymore.

- The `remove()` and `clear()` methods for `GenericForeignKey` related
  managers now perform bulk delete so `Model.delete()` isn't called anymore.

- The `remove()` and `clear()` methods for `ManyToManyField` related
  managers perform nested queries when filtering is involved, which may
  or may not be an issue depending on the database and the data itself.

Refs. #3871, #21174.

Thanks Anssi Kääriäinen and Tim Graham for the reviews.
2013-11-27 19:44:18 +02:00
..
backends Add gis deconstruct() method (this does not make schema work) 2013-11-27 12:56:33 +00:00
migrations Include deferred SQL in sqlmigrate output 2013-11-27 16:29:37 +00:00
models Fixed #21169 -- Reworked RelatedManager methods use default filtering 2013-11-27 19:44:18 +02:00
__init__.py A large number of stylistic cleanups across django/db/ 2013-07-08 10:39:54 +10:00
transaction.py Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
utils.py Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00