Scott
Scott

Reputation: 303

Two different templates for django admin

I'd like to open up the django admin of a new project I'm working on to our users as well as our staff. The problem I'm having is that users and admins have different ways of using the software, and having the same interface be shared between the two groups would lead to inefficiencies.

Is it possible to have the django admin use a specific template if the user is or isn't staff? Or would I need to create two different admin sites?

Upvotes: 0

Views: 192

Answers (1)

Adem Öztaş
Adem Öztaş

Reputation: 21466

You need to create different instances of django.contrib.admin.sites.AdminSite

Docs

Example usage,

# admin.py
from django.contrib.admin.sites import AdminSite

new_admin = AdminSite(name='My New Admin Panel')

new_admin.index_template = "new_admin/index.html"


# urls.py
from myproject.admin import new_admin


(r'^new_admin/(*.)', new_admin.urls)

Upvotes: 1

Related Questions