Within my Users page, I would like to add more column fields to display for each user.
By default, the User page shows username, first name, last name, email, and staff status, but I would also like to add the column "Chosen Groups" to be displayed as well.
Each user can be a part of zero or more groups, so I would like to show a list of all groups (or None) that each user is a part of.
I put something together but I am not sure how to actually get the group data and put it into a "string" form for the "Chosen Groups" column.
Here was my failed attempt...
class UserAdmin(admin.ModelAdmin): list_display = ('username', 'email', 'first_name', 'last_name', 'date_joined', 'get_groups') def get_groups(self, object): #code... #User is registered by default, need to unregister than register to apply custom updates to UserAdmin admin.site.unregister(User) admin.site.register(User, UserAdmin)