Opened 5 years ago

Closed 5 years ago

#20558 closed New feature (fixed)

Add `response_delete` and `render_delete_form` methods to `ModelAdmin`

Reported by: anonymous Owned by: polmuz
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: polmuz Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no



  • It is currently quite easy to set up custom redirects after saving a new or changed object, by overriding response_add() or response_change()
  • I suggest to add a response_delete() method to ModelAdmin, called from delete_view()

Change History (7)

comment:1 Changed 5 years ago by Simon Charette

Easy pickings: set
Needs documentation: set
Needs tests: set
Summary: Suggestion: In ModelAdmin add a response_delete() methodAdd `response_delete` and `render_delete_form` methods to `ModelAdmin`
Triage Stage: UnreviewedAccepted
Version: 1.5master

This feature addition makes sense -- I've hit this limitation in the past.

I will mark as easy picking since it's really just code moving, simple tests and documentation writing.

Also, it might be worth adding a render_delete_form method while we're here, to be consistent with add_view (response_add/render_change_form(add=True)) and change_view (response_change, render_change_form(add=False)).

comment:2 Changed 5 years ago by Sévastien Fievet

Owner: changed from nobody to Sévastien Fievet
Status: newassigned

comment:3 Changed 5 years ago by Sévastien Fievet

As far as I've checked, there's no documentation for response_add/response_change/render_change_form. Shall we add some within this ticket?
Also, there's only one test for all the mentioned hooks, targeting only the post_url_continue parameter form response_add method. Shall we add some more?
If so, where should we put them? In tests/admin/custom_urls? Another app?
Thanks for your feedback.

comment:4 Changed 5 years ago by polmuz

Owner: changed from Sévastien Fievet to polmuz

Since this been quiet for a couple of months, I started to work on it. Here is the pull request:

comment:5 Changed 5 years ago by polmuz

Has patch: set
Needs tests: unset

comment:6 Changed 5 years ago by polmuz

Cc: polmuz added

comment:7 Changed 5 years ago by Jacob

Resolution: fixed
Status: assignedclosed

Fixed in 9079436 and 73de9dd.

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