1
0
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:
Simon Charette
2015-11-20 14:18:47 -05:00
parent c598dfa84a
commit eb7a329fb6
4 changed files with 22 additions and 2 deletions

View File

@@ -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 (