Opened 15 years ago

Closed 15 years ago

#11821 closed (duplicate)

Objects with multiple foreign key relationships to the same table will not correctly warn about deletion of related objects

Reported by: shields@… Owned by: nobody
Component: contrib.admin Version: 1.1
Severity: Keywords:
Cc: mshields@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Consider:

class Thing(models.Model):
    foreground_color = models.ForeignKey(Color, related_name='thing_foreground')
    background_color = models.ForeignKey(Color, related_name='thing_background')

The admin delete view for a Color will correctly warn about the cascade deletions of all Things with that foreground_color. However, it will not show the deletions of Things with that background_color, and they will be deleted. This is surprising and dangerous behavior.

A patch and regression test are included.

Attachments (1)

multiple-fk-delete-view.txt (4.1 KB ) - added by shields@… 15 years ago.

Download all attachments as: .zip

Change History (3)

by shields@…, 15 years ago

Attachment: multiple-fk-delete-view.txt added

comment:1 by anonymous, 15 years ago

Component: Uncategorizeddjango.contrib.admin

comment:2 by Karen Tracey, 15 years ago

Resolution: duplicate
Status: newclosed

This is a dupe of #6191. You might want to attach your patch there, with a .diff extension so that it will hopefully display nicely in trac.

Note: See TracTickets for help on using tickets.
Back to Top