The admin.py at contrib.auth defines the fields to be displayed for the user at the admin interface:
list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff')
I want to see the group of each user here:
Just for testing purpose when you try to add the "group" field it fail:
list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff', 'group')
This error rises: : (admin.E109) The value of 'list_display[5]' must not be a ManyToManyField.
After searching I have found only ways to add an app to the admin interface, or to create a custom user model, but I think I'm missing something.
So, how to do it?
SOLVED --- Thanks to the answer of @{Alexis N-o}
Edit /usr/local/lib/pyton2.7/dist-packages/django/contrib/auth/admin.py
Just before the list_display add this def that seeks for the groups:
def group(self, user):
groups = []
for group in user.groups.all():
groups.append(group.name)
return ' '.join(groups)
group.short_description = 'Groups'
list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff', 'group')
Then syncdb, and check the change at admin, notice the last column: