let me know how to remove the user_permission field from user and groups in a model as shown in below pic
CodePudding user response:
You can remove a field from the default user admin by overriding the UserAdmin Class [source]
# admin.py
from django.contrib.auth.admin import UserAdmin
class CustomUserAdmin(UserAdmin):
# ...
fieldsets = (
(None, {'fields': ('username', 'password')}),
(_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}),
(_('Permissions'), {
'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions'),
}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)
admin.site.register(UserModel, CustomUserAdmin)
CodePudding user response:
Use this to remove user_permission
exclude = ('user_permissions',)