Opened 11 years ago
Closed 11 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: | dev |
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 |
Description
Background:
- 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 by , 11 years ago
Easy pickings: | set |
---|---|
Needs documentation: | set |
Needs tests: | set |
Summary: | Suggestion: In ModelAdmin add a response_delete() method → Add `response_delete` and `render_delete_form` methods to `ModelAdmin` |
Triage Stage: | Unreviewed → Accepted |
Version: | 1.5 → master |
comment:2 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 11 years ago
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 by , 11 years ago
Owner: | changed from | to
---|
Since this been quiet for a couple of months, I started to work on it. Here is the pull request: https://github.com/django/django/pull/1583
comment:5 by , 11 years ago
Has patch: | set |
---|---|
Needs tests: | unset |
comment:6 by , 11 years ago
Cc: | added |
---|
comment:7 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed in 9079436 and 73de9dd.
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 withadd_view
(response_add
/render_change_form(add=True)
) andchange_view
(response_change
,render_change_form(add=False)
).