please help me for customizing my django admin pannel

52 views Asked by At

i should add this tables in my admin class in django please help me i target image

1

There are 1 answers

0
belal_bh On BEST ANSWER

I am not sure if you are trying to get the Group model or just Groups in the User model.

To add Group in Admin you can do like this in admin.py file:

from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group

User = get_user_model()

admin.site.register(User)
admin.site.register(Group)

Or if you just want to add extra properties in User you can do like this in your UserAdmin class:

fieldsets = (
    # ...
    ('Permissions', {'fields': ('groups', 'user_permissions')}),
)

and Update admin.site.register(User) line with

admin.site.register(User, UserAdmin)