diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py index 91c1bfa245..3830052ca3 100644 --- a/django/db/models/deletion.py +++ b/django/db/models/deletion.py @@ -200,10 +200,6 @@ class Collector(object): concrete_model = model._meta.concrete_model for ptr in six.itervalues(concrete_model._meta.parents): if ptr: - # FIXME: This seems to be buggy and execute a query for each - # parent object fetch. We have the parent data in the obj, - # but we don't have a nice way to turn that data into parent - # object instance. parent_objs = [getattr(obj, ptr.name) for obj in new_objs] self.collect(parent_objs, source=model, source_attr=ptr.remote_field.related_name, diff --git a/tests/delete/tests.py b/tests/delete/tests.py index 9bb179cb3f..d0a1bc5995 100644 --- a/tests/delete/tests.py +++ b/tests/delete/tests.py @@ -475,11 +475,7 @@ class FastDeleteTests(TestCase): c = Child.objects.create() p = Parent.objects.create() # 1 for self, 1 for parent - # However, this doesn't work as child.parent access creates a query, - # and this means we will be generating extra queries (a lot for large - # querysets). This is not a fast-delete problem. - # self.assertNumQueries(2, c.delete) - c.delete() + self.assertNumQueries(2, c.delete) self.assertFalse(Child.objects.exists()) self.assertEqual(Parent.objects.count(), 1) self.assertEqual(Parent.objects.filter(pk=p.pk).count(), 1)