diff --git a/django/contrib/messages/views.py b/django/contrib/messages/views.py
index eaa1bee9d5..ac938f7845 100644
a
|
b
|
class SuccessMessageMixin:
|
16 | 16 | |
17 | 17 | def get_success_message(self, cleaned_data): |
18 | 18 | return self.success_message % cleaned_data |
| 19 | |
| 20 | |
| 21 | class SuccessDeleteMessageMixin: |
| 22 | """ |
| 23 | Add a success message on a successful DELETE request (and sometimes POST request |
| 24 | if this will make trigger delete). |
| 25 | """ |
| 26 | success_message = '' |
| 27 | |
| 28 | def delete(self, *args, **kwargs): |
| 29 | response = super().delete(*args, **kwargs) |
| 30 | success_message = self.get_success_message() |
| 31 | if success_message: |
| 32 | messages.success(self.request, success_message) |
| 33 | return response |
| 34 | |
| 35 | def get_success_message(self): |
| 36 | return self.success_message |