Opened 12 years ago

Closed 11 years ago

#17666 closed New feature (wontfix)

current_app can not be overridden in template

Reported by: crass@… Owned by: anonymous
Component: contrib.admin Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Sometimes you'd like to change the current_app for a particular set or url resolutions in a template. The following might be convenient way of doing this:

  {% with current_app="admin" %}
     {% url admin:index %}
  {% endwith %}

This won't work currently because current_app is only respected if its an attribute on the context not a key in the context.

The concrete problem I'm having is that I have two admin sites, one is the default another named "staffadmin". When on a page in the staffadmin site {% url admin:index %} can not resolve to the default's index, but is always the staffadmin index.

Change History (3)

comment:1 by Florian Apolloner, 12 years ago

Owner: changed from nobody to anonymous
Status: newassigned

The problem here is that admin is the instance name and namespace name. Now if you are in another admin app with a different instance name, {% url admin:index %} won't pick the default instance but will resolve using the current_app since admin is also the namespace name. As such you can never show a link to the default instance from the template.

comment:2 by Jannis Leidel, 12 years ago

Component: Uncategorizedcontrib.admin
Triage Stage: UnreviewedDesign decision needed
Type: UncategorizedNew feature

current_app is the same as the name attribute of the used AdminSite instances, so there is already a well defined API for changing the name. I don't see a way to optionally allow that to happen on template level. Marking for design decision needed.

comment:3 by Jacob, 11 years ago

Resolution: wontfix
Status: assignedclosed

Agree with jezdez. So marking wontfix.

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