Opened 16 years ago
Closed 16 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: | 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)
Change History (3)
by , 16 years ago
| Attachment: | multiple-fk-delete-view.txt added |
|---|
comment:1 by , 16 years ago
| Component: | Uncategorized → django.contrib.admin |
|---|
comment:2 by , 16 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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.