django/django — pull request #2940 by kostko (2014-07-22 09:48:30+00:00)
Title: Fix cascaded deletion of polymorphic models

Currently, when deleting polymorphic models (for example by using `django-polymorphic`), the `django.db.models.deletion.Collector` incorrectly assumes that all models are of the same type as the first model in the list. Then, it generates incorrect delete statements when polymorphic models are used which then result in an `IntegrityError` when the transaction is committed. This is a patch that fixes this issue and it is directly based on a patch submitted by Kronuz at the end of ticket #16128.