Opened 14 years ago

Closed 14 years ago

Last modified 13 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: dev
Severity: Keywords: extends admin templates
Cc: rico.bl@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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 by jacmkno, 14 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by Ramiro Morales, 14 years ago

Triage Stage: Design decision neededUnreviewed

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

comment:3 by Enrico, 14 years ago

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 by Enrico, 14 years ago

Cc: rico.bl@… added

comment:5 by Luke Plant, 14 years ago

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 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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