Create Another Admin Site in Django

Django
2021-01-20 20:10 (4 years ago) ytyng

If you want to create a separate URL for Django Admin while keeping /admin/ as it is.

Example: Create it at /staff/

1. staff/__init__.py

from django.contrib.admin import AdminSite
site = AdminSite(name='staff')


Main urls.py

from staff import site as staff_site

...

url('^staff/', include(staff_site.urls)),

Admin.py for each model

from staff import site as staff_site

@admin.register
(MyModel)
@admin.register(MyModel, site=staff_site)
class MyModelAdmin(admin.ModelAdmin):
...
...
Currently unrated
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Archive

2025
2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011