#36264: keep_parents=True does not exclude proxy neighbors
-------------------------------------+-------------------------------------
Reporter: Vladimir | Type: Bug
Status: new | Component: Database
| layer (models, ORM)
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
{{{
class Foo(Model):
pass
class Bar(Foo):
pass
class Baz(Foo):
class Meta:
proxy = True
class BazItem(Model):
baz = ForeignKey(to=Baz, on_delete=CASCADE)
...
bar = Bar.objects.create()
baz = Baz.objects.all().first()
BazItem.objects.create(baz=baz)
assert BazItem.objects.all().count() == 1
bar.delete(keep_parents=True)
assert BazItem.objects.all().count() == 0
}}}
seems `django.db.models.deletion.Collector.collect`
{{{
if keep_parents and related.model in model._meta.all_parents:
continue
}}}
should use `concrete_model`
--
Ticket URL: <
https://code.djangoproject.com/ticket/36264>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.