Opened 6 years ago

Closed 5 years ago

#11841 closed (invalid)

Allow subclasses of AdminSite to overwrite all admin templates

Reported by: pjanderson Owned by: nobody
Component: contrib.admin Version: 1.1
Severity: Keywords: AdminSite templates
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When creating custom admin sites, it is sometimes expected to modify each site's branding, if not the whole look of the custom admin site (by providing custom stylesheets.) AdminSite class allows to overwrite index, login and app_index templates in its subclasses, but not every template.

Would it be possible to allow AdminSite subclasses to define all of its own templates? For example, I changed these three templates to provide custom branding for local, regional and worldwide content managers and administrators, but when viewing application records, default "change_list.html" template is used and it is extending default "base_site.html".

Perhaps I haven't looked at the source code too closely, or maybe there is no way to do that quickly and simply.

Change History (2)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by Honza_Kral

  • Resolution set to invalid
  • Status changed from new to closed

Hey, you can override any template, the only downside is that some are on AdminSite and others on ModelAdmin. Since this is not a main-stream use case I would recommend to create your own ModelAdmin subclass defining all the template names and derive your individual ModelAdmin classes from that.

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