Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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 Ramiro Morales, 12 years ago

See also #8001.

comment:2 by Ramiro Morales, 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 Ramiro Morales <cramm0@…>, 12 years ago

Resolution: fixed
Status: newclosed

In 0b908b92a2ca4fb74a103e96bb75c53c05d0a428:

Fixed #8001 -- Made redirections after add/edit in admin customizable.

Also fixes #18310.

comment:4 by Ramiro Morales <cramm0@…>, 12 years ago

In 35d1cd0b28d1d9cd7bffbfbc6cc2e02b58404415:

Fixed #19505 -- A more flexible implementation for customizable admin redirect urls.

Work by Julien Phalip.

Refs #8001, #18310, #19505. See also 0b908b92a2ca4fb74a103e96bb75c53c05d0a428.

comment:5 by Ramiro Morales <cramm0@…>, 12 years ago

In 3ad34c231bb6e13c29dd268f9557a9cb241280fa:

[1.5.x] Fixed #19505 -- A more flexible implementation for customizable admin redirect urls.

Work by Julien Phalip.

Refs #8001, #18310, #19505. See also 0b908b92a2ca4fb74a103e96bb75c53c05d0a428.

35d1cd0b28d1d9cd7bffbfbc6cc2e02b58404415 from master.

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