[Answered ]-Django: How to change to success message for update_object?

2👍

I am assuming that you are talking about the update_object generic view.

If that is the case then there is no way (hook) to change the success message at present (Django 1.2.3). You can see this for yourself in the source code. Just look for update_object.

One rather flaky way to do this would be to use a custom post_save_redirect and render the message yourself. The post_save_redirect can be a simple view to display the appropriate success message. This will mean losing the redirection to the object’s permalink though.

You can also try adding a custom message (using messages.success) and then redirect to the saved object’s permalink in the wrapper. I haven’t tried this myself so I do not know how this will turn out.

Leave a comment