#25520: Cascade delete of proxy model children fails with IntegrityErrors
-------------------------------+--------------------
     Reporter:  jmurty         |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  master
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 When deleting a concrete model based on proxy models, Django's deletion
 collector does not find M2M reverse relationships to proxy parents; it
 only finds these relationships for concrete parent models.

 This means that deleting a proxy-based model object with extant M2M
 relationships targeting a proxy parent will fail with integrity errors if
 you use a database like PostgreSQL that enforces foreign key constraints.
 The target model instance cannot be deleted because the M2M FK
 relationships are not also deleted at the same time, and would otherwise
 remain pointing to a non-existent record.

 This issue tends to affect users of django-polymorphic who rely more than
 most on proxy models, and has been reported in this context in #23076

 I have created a Pull Requests based on the current master branch that
 adds unit tests demonstrating the issue when run against a database that
 enforces foreign key constrains, such as PostgreSQL:
 ​https://github.com/django/django/pull/5404

 This issue also affects versions 1.7 and 1.8 and perhaps also earlier
 versions, but likely has not been encountered broadly because the use case
 that triggers it is somewhat unusual.

--
Ticket URL: <https://code.djangoproject.com/ticket/25520>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.14b43ffd5de25cb95b363301c493d5d5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to