#18310 closed New feature (fixed)
Make named return URLs configurable
Reported by: | Russell Keith-Magee | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
As of 1.4, The admin views have been modified to use named URLs instead of ../../.. paths for the redirects on success for add and change views (the return values of ModelAdmin.response_add() and ModelAdmin.response_change()).
However, the use of these named URLs requires that the named URL exists, which won't necessarily be the case.
As an example, django-treemenus adds some customisations to make it easy to define a tree hierarchy of MenuItem objects. To do this, it registers Menu with admin; A dummy ModelAdmin for MenuItem is used to provide the views for the entries on the menu.
MenuItem.response_add() tries to return to the named URL 'treemenus_menuitem_changelist' -- however this named URL doesn't exist, because MenuItem isn't registered with the admin.
There's no easy way to customize the named URL that you want the change view to return to. This would be an easy thing to configure with an argument (or arguments) to response_change and response_add.
Change History (5)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
I've attached a patch for this in attachment:8001_18072_18310.6.diff:ticket:8001. Mostly to know if I'm interpreting Russell's report correctly and to start discussion about if this is an approach we want to pursue.
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
See also #8001.