Make named return URLs configurable
|Reported by:||russellm||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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:3 Changed 17 months ago by Ramiro Morales <cramm0@…>
- Resolution set to fixed
- Status changed from new to closed