layers Introducing Unfold components - Pre-made HTML blocks in Django admin for custom dashboards arrow_forward

User & group models

By default, when django.contrib.auth is in INSTALLED_APPS, you are going to have user and group models in admin. Both models are going to work but they will look unstyled because they are not inheriting from unfold.admin.ModelAdmin.

The solution is to unregister default admin classes and then register them back by using unfold.admin.ModelAdmin like in the example below

# admin.py

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.admin import GroupAdmin as BaseGroupAdmin
from django.contrib.auth.models import User, Group

from unfold.admin import ModelAdmin


admin.site.unregister(User)
admin.site.unregister(Group)


@admin.register(User)
class UserAdmin(BaseUserAdmin, ModelAdmin):
    pass


@admin.register(Group)
class GroupAdmin(BaseGroupAdmin, ModelAdmin):
    pass

Be first to know about new features and updates

Each time something new happens in Unfold, like new major features or new design components, we'll send you a newsletter. We promise not to spam you.

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.