#21926 closed Cleanup/optimization (duplicate)

SuccessMessageMixin not working for DeleteView

Reported by: django@… Owned by: nobody
Component: Generic views Version: 1.6
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Neither setting

success_message = "Something!"

or

def get_success_message(self, cleaned_data):
     return "Something"*10

works. I can confirm that the SuccessMessageMixin works fine for UpdateView and CreateView. Here's a quit sample project:

https://dpaste.de/XXo2#L

Change History (3)

comment:1 Changed 15 months ago by charettes

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/optimization

SuccessMessageMixin hooks to form_valid which is not present on DeleteView to push its message to the user.

I remember seeing another ticket or discussion about the unification of DeleteView with CreateView and UpdateView. If someone else manage to find such a ticket I think it should supersede this one since the SuccessMessageMixin issue described here is really just a side effect of the deviation of DeleteView.

comment:2 Changed 15 months ago by django@…

I guessed as much. FWIW my (temporary) solution was to just set a success message in def delete(self, request, *args, **kwargs)

Thanks for the quick reply/update. At least now I know I'm not missing something :)

comment:3 Changed 11 months ago by olethanh

  • Resolution set to duplicate
  • Status changed from new to closed

Closing it as it is a duplicate of #21936

Note: See TracTickets for help on using tickets.
Back to Top