Ticket #32514: patch.patch

File patch.patch, 891 bytes (added by Willem Van Onsem, 4 years ago)

patch to apply

  • django/contrib/messages/views.py

    diff --git a/django/contrib/messages/views.py b/django/contrib/messages/views.py
    index eaa1bee9d5..ac938f7845 100644
    a b class SuccessMessageMixin:  
    1616
    1717    def get_success_message(self, cleaned_data):
    1818        return self.success_message % cleaned_data
     19
     20
     21class 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
Back to Top