django-bootstrap-modal-forms icon indicating copy to clipboard operation
django-bootstrap-modal-forms copied to clipboard

Delete view success message is shown although object not deleted

Open christianwgd opened this issue 1 year ago • 1 comments

If I override the post method of the BSDeleteModal class to handle a ProtectedError (because a foreign key is still pointing to the object that should be deleted), the success message is shown although there's a redirect to another view.

I've made some extensions to the sample app to demonstrate the problem: https://github.com/christianwgd/django-bootstrap-modal-forms/tree/message_error I've added a new object to the model that has a foreign key to a book. To avoid changes to the ui I added an admin for both models.

The only workaround for the problem I found by now was overriding the complete post method, setting the success message from there and set the class property success_message to None.

christianwgd avatar May 12 '23 07:05 christianwgd