1
0
mirror of https://github.com/django/django.git synced 2024-11-18 15:34:16 +00:00
django/docs/ref/models
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
..
fields.txt Fixed #21507 -- Corrected default widget information for FileField 2013-11-25 08:26:10 -05:00
index.txt Consolidated documentation for F() and Q() 2013-09-06 12:57:25 -05:00
instances.txt Consolidated documentation for F() and Q() 2013-09-06 12:57:25 -05:00
options.txt Fixed #21479 -- Favor 'migrate' over 'syncdb' in the docs. 2013-11-21 15:12:39 +01:00
queries.txt Fixed #17001 -- Custom querysets for prefetch_related. 2013-11-07 14:49:49 +02:00
querysets.txt Fixed #21169 -- Reworked RelatedManager methods use default filtering 2013-11-27 19:44:18 +02:00
relations.txt Whitespace cleanup. 2013-10-10 16:49:20 -04:00