[Django] #32289: Multi Theme support for the Admin

12 views
Skip to first unread message

Django

unread,
Dec 21, 2020, 5:27:21 AM12/21/20
to django-...@googlegroups.com
#32289: Multi Theme support for the Admin
-----------------------------------------+------------------------
Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
**Issue**:
There is no way to mix between several admin themes.
Say i installed a 3rd party admin theme and i want to use it along with
the default (or with another 3rd party theme)

While we can have many different admin sites, all admin sites currently
must share the same theme.
Because the admin assumes the template directory 'admin' all the time.


**Proposal**:
A way to direct each AdminSite to the template path where it should find
the templates.


**Example**:
Add a setting called `ADMIN_DEFAULT_THEME = 'admin'`
Add an attribute to AdminSite called `theme` which default to
`ADMIN_DEFAULT_THEME`, and basically this setting controls which
directory this admin site looks for templates.

So whenever a path like 'admin/some_file_name.html' occurs, it is to be
replaced with something like
`f'{admin_theme}/some_file_name.html'`
This will take effect in extends statements, AdminSite templates
loading(index/app index / etc) and ModelAdmin template loading (change
form/list/delete etc..)

If accepted then i'd love to start working on it.

--
Ticket URL: <https://code.djangoproject.com/ticket/32289>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 21, 2020, 6:02:54 AM12/21/20
to django-...@googlegroups.com
#32289: Multi Theme support for the Admin
-------------------------------+--------------------------------------

Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate


Comment:

You can use
[https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.AdminSite.index_template
AdminSite.index_template]/[https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.AdminSite.app_index_template
app_index_template] and override CSS to use different theme for each admin
site. Also with #32018 changing a theme will be much simpler. I think we
can close it as a duplicate of #32018.

--
Ticket URL: <https://code.djangoproject.com/ticket/32289#comment:1>

Django

unread,
Dec 21, 2020, 7:45:46 AM12/21/20
to django-...@googlegroups.com
#32289: Multi Theme support for the Admin
-------------------------------+--------------------------------------

Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Ramez Issac):

* status: closed => new
* resolution: duplicate =>


Comment:

I don't think it qualifies as a duplicate .

By "theme" i mean a complete HTML structure (not just the colors as
#32018 aims) and there is currently no way to have this HTML structure
unique per AdminSite.. and that's what this ticket is about adding.

Replying on Changing the app index and the index template:
This is not the same a new theme.. because clicking on any admin link
inside those "edited pages" would mean either 1.going back to the default
theme for that clicked link or 2. that those ModelAdmin templates were
explicitly set as well.

I hope i made the ticket clearer.

Thanks

--
Ticket URL: <https://code.djangoproject.com/ticket/32289#comment:2>

Django

unread,
Dec 21, 2020, 8:04:13 AM12/21/20
to django-...@googlegroups.com
#32289: Multi Theme support for the Admin
-------------------------------+--------------------------------------

Reporter: Ramez Issac | Owner: nobody
Type: New feature | Status: closed
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed

* resolution: => wontfix


Comment:

If you need/want to change all templates, then you shouldn't use
`django.contrib.admin` but rather prepare your own admin interface. I
don't think that we would like to support such an extensive customization.
You can start a discussion on DevelopersMailingList (where you'll reach a
wider audience) if you don't agree.

--
Ticket URL: <https://code.djangoproject.com/ticket/32289#comment:3>

Reply all
Reply to author
Forward
0 new messages