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|
|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)
Changed 6 years ago by shields@…
comment:1 Changed 6 years ago by anonymous
- Component changed from Uncategorized to django.contrib.admin
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset