summaryrefslogtreecommitdiff
path: root/tests/delete_regress/models.py
AgeCommit message (Collapse)Author
2024-02-08Fixed #35073 -- Avoided unnecessary calling of callables used by ↵bcail
SET/SET_DEFAULT in Collector.collect().
2022-08-27Fixed #33928 -- Avoided unnecessary queries when cascade updating.Simon Charette
Models that use SET, SET_NULL, and SET_DEFAULT as on_delete handler don't have to fetch objects for the sole purpose of passing them back to a follow up UPDATE query filtered by the retrieved objects primary key. This was achieved by flagging SET handlers as _lazy_ and having the collector logic defer object collections until the last minute. This should ensure that the rare cases where custom on_delete handlers are defined remain uncalled when when dealing with an empty collection of instances. This reduces the number queries required to apply SET handlers from 2 to 1 where the remaining UPDATE use the same predicate as the non removed SELECT query. In a lot of ways this is similar to the fast-delete optimization that was added in #18676 but for updates this time. The conditions only happen to be simpler in this case because SET handlers are always terminal. They never cascade to more deletes that can be combined. Thanks Renan GEHAN for the report.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-04-27Refs #32682 -- Fixed QuerySet.delete() crash on querysets with ↵Mariusz Felisiak
self-referential subqueries on MySQL.
2018-01-13Fixed #29016 -- Fixed incorrect foreign key nullification on related ↵Étienne Loks
instance deletion.
2015-07-27Fixed #21127 -- Started deprecation toward requiring on_delete for ↵Flavio Curella
ForeignKey/OneToOneField
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-01-26Fixed #19774 -- Deprecated the contenttypes.generic module.Simon Charette
It contained models, forms and admin objects causing undesirable import side effects. Refs #16368. Thanks to Ramiro, Carl and Loïc for the review.
2013-11-02PEP8 cleanupJason Myers
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-02-26Merged regressiontests and modeltests into the test root.Florian Apolloner