Django Admin Override User Panel
Remove Permissions Panel From Django User Admin Panel
Sometimes it can be a little bit tricky to figure out how to customize your Django admin setup.
I had one very specific task:
Remove the Permissions panel from the Django user admin panel.
The best way I figured to do this, was to extended the UserAdmin
1 class and modify the fieldsets
2 prop.
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
class AdminUser (UserAdmin):
fieldsets = (
(None, {'fields': ('username', 'password')}),
(_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)
# fieldsets = UserAdmin.fieldsets - (
# (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',
# 'groups', 'user_permissions')}),
# )
admin.site.unregister(User)
admin.site.register(User, AdminUser)