Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

300
Views
Django - Change Fields in Group Admin Model

The built-in django group model on the admin site only shows name:

enter image description here

but I want to include additional fields that are already part of the group model, such as id.

I have tried adding these fields using the following admin.py setup:

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


class GroupsAdmin(admin.ModelAdmin):
    list_display = ["name", "pk"]
    class Meta:
        model = Group

admin.site.register(Group, GroupsAdmin)

But this returns the error:

django.contrib.admin.sites.AlreadyRegistered: The model Group is already registered.

I have successfully registered other models (I've created) on admin but the above doesn't work for those models that are already a part of django.

How can I add fields in the admin model for Group?

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

The accepted answer is correct, however, I would like to point out that you could inherit from the GroupAdmin, if your goal is only extending that is and not modifying:

from django.contrib.auth.admin import GroupAdmin

class GroupsAdmin(GroupAdmin):
    list_display = ["name", "pk"]

admin.site.unregister(Group)
admin.site.register(Group,GroupsAdmin)
about 4 years ago · Santiago Trujillo Report

0

You need to unregister it first from the built-in Group model and then register it again with your custom GroupAdmin model.

So:

class GroupsAdmin(admin.ModelAdmin):
    list_display = ["name", "pk"]
    class Meta:
        model = Group

admin.site.unregister(Group)
admin.site.register(Group, GroupsAdmin)

Also, the Meta class is not required. You can remove it.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!