Objects with multiple foreign key relationships to the same table will not correctly warn about deletion of related objects
|Reported by:||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.
Change History (3)
comment:1 Changed 7 years ago by
|Component:||Uncategorized → django.contrib.admin|
|Patch needs improvement:||unset|