Question
Custom error message in Django admin actions
I've written custom admin actions that basically do QuerySet.update()
for certain fields in the model. There are times when these actions shouldn't be allowed to complete -- instead, they should display an error and not do anything. I've tried message_user
, but that displays a green checkmark, whereas I'd like it to display the Django admin error message.
A solution I've found online is to use a ModelForm
, but I don't think that applies in this case, as here everything happens on the admin change list page.