In order to create a custom admin site, Unfold provides the unfold.sites.UnfoldAdminSite
class which can be used as follows:
# sites.py
from django.contrib import admin
from unfold.sites import UnfoldAdminSite
class CustomAdminSite(UnfoldAdminSite):
pass
custom_admin_site = CustomAdminSite(name="custom_admin_site")
# urls.py
from django.urls import path
from .sites import custom_admin_site
urlpatterns = [
# other URL patterns
path("admin/", custom_admin_site.urls),
]
# models.py
from django.contrib.auth.models import User
from unfold.admin import ModelAdmin
@admin.register(User, site=custom_admin_site)
class UserAdmin(ModelAdmin):
model = User
Note: If you use the default django.contrib.admin.AdminSite
you will receive a NoReverseMatch
error because the default admin site does not contain all URL patterns required by Unfold.
Django admin theme built with Tailwind CSS to bring modern look and feel to your admin interface. Already contains several built-in features for smooth developer experience.
© 2023 - 2024 Created by unfoldadmin.com. All rights reserved.