change after successful delete flash message in flask-admin

Viewed 98

how to change after successful delete flash message in flask-admin?

flash(ngettext('Record was successfully deleted.',
                           '%(count)s records were successfully deleted.',
                           count,
                           count=count), 'success')

To

flash(ngettext('Account was successfully unlinked.',
                           '%(count)s records were successfully deleted.',
                           count,
                           count=count), 'success')
1 Answers

I think that the only way to achieve this is to rewrite the entire delete_view method, and change the message to whatever you want.

If you want to do change the message for many models, use inheritance and create a method like get_delete_message, which will be called from inside the delete_view.

Related