mirror of https://github.com/django/django.git
Refs #15250 -- Removed an obsolete comment regarding MTI cascade deletion.
This commit is contained in:
parent
66e1ebbffc
commit
0bbab97c28
|
@ -200,10 +200,6 @@ class Collector(object):
|
||||||
concrete_model = model._meta.concrete_model
|
concrete_model = model._meta.concrete_model
|
||||||
for ptr in six.itervalues(concrete_model._meta.parents):
|
for ptr in six.itervalues(concrete_model._meta.parents):
|
||||||
if ptr:
|
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]
|
parent_objs = [getattr(obj, ptr.name) for obj in new_objs]
|
||||||
self.collect(parent_objs, source=model,
|
self.collect(parent_objs, source=model,
|
||||||
source_attr=ptr.remote_field.related_name,
|
source_attr=ptr.remote_field.related_name,
|
||||||
|
|
|
@ -475,11 +475,7 @@ class FastDeleteTests(TestCase):
|
||||||
c = Child.objects.create()
|
c = Child.objects.create()
|
||||||
p = Parent.objects.create()
|
p = Parent.objects.create()
|
||||||
# 1 for self, 1 for parent
|
# 1 for self, 1 for parent
|
||||||
# However, this doesn't work as child.parent access creates a query,
|
self.assertNumQueries(2, c.delete)
|
||||||
# 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.assertFalse(Child.objects.exists())
|
self.assertFalse(Child.objects.exists())
|
||||||
self.assertEqual(Parent.objects.count(), 1)
|
self.assertEqual(Parent.objects.count(), 1)
|
||||||
self.assertEqual(Parent.objects.filter(pk=p.pk).count(), 1)
|
self.assertEqual(Parent.objects.filter(pk=p.pk).count(), 1)
|
||||||
|
|
Loading…
Reference in New Issue