diff --git a/separate_users/admin.py b/separate_users/admin.py index 1d85289..5ee49c9 100644 --- a/separate_users/admin.py +++ b/separate_users/admin.py @@ -15,7 +15,7 @@ class FrontendUserAdmin(UserAdmin): readonly_fields = ['date_joined', 'last_login', 'is_staff', 'is_superuser', 'groups', 'user_permissions', ] list_filter = ['is_active', 'groups', ] - list_display = ['username', 'is_active', ] + list_display = ['username', 'is_active', 'get_groups', ] admin.site.register(FrontendUser, FrontendUserAdmin) @@ -25,7 +25,7 @@ class EditorAdmin(UserAdmin): exclude = [] readonly_fields = ['date_joined', 'last_login', 'is_staff', 'is_superuser', 'user_permissions', ] list_filter = ['is_active', 'groups', ] - list_display = ['username', 'is_active', ] + list_display = ['username', 'is_active', 'get_groups', ] admin.site.register(Editor, EditorAdmin) diff --git a/separate_users/models.py b/separate_users/models.py index 52985a5..d93a309 100644 --- a/separate_users/models.py +++ b/separate_users/models.py @@ -38,7 +38,19 @@ def get_queryset(self): .filter(is_staff=True, is_superuser=False) -class FrontendUser(UserModel): +class SeparateUserBase(object): + + class Meta: + proxy = True + + def get_groups(self): + print self.groups.all() + return ', '.join([str(item) for item in self.groups.all()]) + + get_groups.short_description = ("Groups") + + +class FrontendUser(SeparateUserBase, UserModel): objects = FrontendUserManager() @@ -46,11 +58,7 @@ def save(self, *args, **kwargs): self.is_staff = False super(FrontendUser, self).save(*args, **kwargs) - class Meta: - proxy = True - - -class Editor(UserModel): +class Editor(SeparateUserBase, UserModel): objects = EditorManager()