From 8bdfabed6563f2ae136ad43e05bb254c9c15811a Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Wed, 7 Oct 2015 14:04:57 -0400 Subject: [PATCH] Refs #18012 -- Removed special casing for proxy models deletion. This isn't required anymore now that reverse foreign keys from proxy models are propagated to their concrete model. --- django/db/models/deletion.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py index a8c98f5b83..831e3c03db 100644 --- a/django/db/models/deletion.py +++ b/django/db/models/deletion.py @@ -1,5 +1,4 @@ from collections import Counter, OrderedDict -from itertools import chain from operator import attrgetter from django.db import IntegrityError, connections, transaction @@ -53,18 +52,10 @@ def DO_NOTHING(collector, field, sub_objs, using): def get_candidate_relations_to_delete(opts): - # Collect models that contain candidate relations to delete. This may include - # relations coming from proxy models. - 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( - 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 ( - f for f in candidate_model_fields + f for f in opts.get_fields(include_hidden=True) if f.auto_created and not f.concrete and (f.one_to_one or f.one_to_many) )