mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
[1.9.x] Fixed #25685 -- Fixed a duplicate query regression on deletion of proxied models.
Thanks to Trac alias ppetrid for the report and Tim for the review.
Conflicts:
tests/delete/tests.py
Forward port of 7c3ef19978 from stable/1.8.x
This commit is contained in:
@@ -58,9 +58,9 @@ def get_candidate_relations_to_delete(opts):
|
||||
candidate_models = {opts}
|
||||
candidate_models = candidate_models.union(opts.concrete_model._meta.proxied_children)
|
||||
# For each model, get all candidate fields.
|
||||
candidate_model_fields = chain.from_iterable(
|
||||
candidate_model_fields = set(chain.from_iterable(
|
||||
opts.get_fields(include_hidden=True) for opts in candidate_models
|
||||
)
|
||||
))
|
||||
# The candidate relations are the ones that come from N-1 and 1-1 relations.
|
||||
# N-N (i.e., many-to-many) relations aren't candidates for deletion.
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user