Code

Opened 3 months ago

Last modified 3 days ago

#21936 assigned New feature

Allow delete to provide a success message through a mixin.

Reported by: david.fischer.ch@… Owned by: CarolineSimpson
Component: contrib.messages Version: master
Severity: Normal Keywords: mixin
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Add a mixin to show a message on successful object deletion.

Attachments (1)

0001-Add-deletemessagemixin.patch (1.2 KB) - added by david.fischer.ch@… 3 months ago.
The patch for this contribution

Download all attachments as: .zip

Change History (7)

Changed 3 months ago by david.fischer.ch@…

The patch for this contribution

comment:1 Changed 2 months ago by AeroNotix

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset

comment:2 Changed 4 weeks ago by aaugustin

  • Needs documentation set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to New feature

Your patch sets the message before the object is deleted. What if deleting the object fails?

Otherwise, this addition makes sense.

comment:3 Changed 5 days ago by CarolineSimpson

  • Owner changed from nobody to CarolineSimpson
  • Status changed from new to assigned

comment:4 Changed 3 days ago by CarolineSimpson

  • Summary changed from Add delete message mixin to Allow delete to provide a success message through a mixin.

Here is a pull request that approaches the problem from a different angle: https://github.com/django/django/pull/2585
Instead of adding a new mixin, the DeleteView is refactored to allow it to work with the existing SuccessMessageMixin.
Thanks to @charettes for the approach and much of the code.

comment:5 Changed 3 days ago by CarolineSimpson

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:6 Changed 3 days ago by bmispelon

  • Triage Stage changed from Accepted to Ready for checkin

The approach seems sensible to me and the patch looks quite good.

I'm going to mark this as ready for checkin so that we can get another set of eyes on this in case I've missed something.

Thanks!

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
The owner will be changed from CarolineSimpson to anonymous. Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.