Opened 11 years ago

Closed 10 years ago

#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 by Simon Charette, 11 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/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 by django@…, 11 years ago

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 by Olivier Le Thanh Duong, 10 years ago

Resolution: duplicate
Status: newclosed

Closing it as it is a duplicate of #21936

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