Deleting a protected fk relationships throws error 500 when deleting inlines
|Reported by:||rafadev||Owned by:||javimansilla|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Better explained with an example.
We have 3 models, Category, Subcategory and Item. Subcategory has a protected (on_delete=models.PROTECT) fk relationship to Category, and Item has a protected fk relationship to Subcategory.
When trying to delete a Category that has Subcategories, the Django admin displays a readable, understandable message explaining that the model instance has related models, so it can't be deleted. However, if the Subcategories are displayed as inlines in the Category admin, and one tries to delete a Subcategory that has related items, Django throws an uncatched error 500, instead of a human-readable message.
Change History (7)
comment:1 Changed 2 years ago by rafadev
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 2 years ago by javimansilla
- Owner changed from nobody to javimansilla
- Status changed from new to assigned