Django admin: using different templates for two admin sites

I have a Django project with two different admin sites (as described in the documentation )

I would like to have different custom templates for each of them. I know how to override a custom template by placing html files in the myproject / templates / admin / directory. However, both admin sites use these templates!

I do not understand how to specify a different set of custom templates.

Ideally, I would like to have:

# For first admin site
myproject/templates/admin-a/
   base.html
   base_site.html

and

# For second admin site
myproject/templates/admin-b/
   base.html
   base_site.html

Any ideas?

Thanks Stéphane

+5
source share
1 answer

ModelAdmin, , , , :

# Custom templates (designed to be over-ridden in subclasses)
add_form_template = None
change_form_template = None
change_list_template = None
delete_confirmation_template = None
delete_selected_confirmation_template = None
object_history_template = None

.

- , () extends. .

, TEMPLATE_DIRS, , :

TEMPLATE_DIRS = ('templates-a',)

TEMPLATE_DIRS = ('template-b', 'template-a')

dirs , , , .

( ), , ( ).

+1

All Articles