Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#14140 closed (duplicate)

There is no way to override admin templates to the project level

Reported by: jacmkno Owned by: nobody
Component: Template system Version: master
Severity: Keywords: extends admin templates
Cc:… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The template system allows to override admin templates for applications and models but for the project level it throws 'maximum recursion depth exceeded' because the template system keeps looking for the extended template in the current template path. For example this code generates the problem when placed in "project/templates/admin/base.html":

{% extends "/admin/base.html" %}

I have been unable to think of a solution for this problem yet, but I think this is an important missing feature. I think patches from Ticket #2414 may be used to solve this problem.

Change History (6)

comment:1 Changed 8 years ago by jacmkno

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 8 years ago by Ramiro Morales

Triage Stage: Design decision neededUnreviewed

'untriaging' until another pair of eyes can look at this.

comment:3 Changed 8 years ago by Enrico

I think every admin template should extend a "base" template.
This way it would be possible to override templates on the project level (and maybe through external apps also).

As an example, my solution for customizing the admin index:

  • Move the original admin/index.html template to django/contrib/admin/templates/admin/base
  • Create the admin/index.html template that extends admin/base/index.html
    {# admin/index.html #}
    {% extends "admin/base/index.html" %}
    {# ... customizations here ... #}
  • On the project level, admin/index.html would extend admin/base/index.html and override the one bundled with the admin app

I can take this ticket if this solution is reasonable.

comment:4 Changed 8 years ago by Enrico

Cc:… added

comment:5 Changed 8 years ago by Luke Plant

Resolution: duplicate
Status: newclosed

I think this is basically the same underlying issue as #8158. Please re-open if that's not the case. Note also the workaround on that ticket.

comment:6 Changed 7 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

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