Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #23076 - Fix cascaded deletion of polymorphic models #2940

Closed
wants to merge 3 commits into from

Conversation

kostko
Copy link
Contributor

@kostko kostko commented Jul 22, 2014

Ticket: #23076

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.

Patch based on a patch by Kronuz in django#16128.
@kezabelle
Copy link
Contributor

The patch as is will fail under Python 3 I believe, because of the many usages of iteritems() on a dict instance. It'd either need to change to use the vendor'd six.iteritems or just use items() I guess.

@timgraham timgraham changed the title Fix cascaded deletion of polymorphic models Fixed #23076 - Fix cascaded deletion of polymorphic models Aug 4, 2014
@timgraham
Copy link
Member

Closing per ticket.

@timgraham timgraham closed this Oct 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants