From acd04c95e69ca5ddd9e84c09061295d62c1c801a Mon Sep 17 00:00:00 2001 From: benzkji Date: Fri, 25 May 2018 10:21:39 +0200 Subject: [PATCH] changelist with complete name --- separate_users/admin.py | 4 ++-- separate_users/models.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/separate_users/admin.py b/separate_users/admin.py index 20f2ec7..6df41e5 100644 --- a/separate_users/admin.py +++ b/separate_users/admin.py @@ -27,7 +27,7 @@ def get_urls(self): class FrontendUserAdmin(SeparateUserAdminBase): readonly_fields = ['date_joined', 'last_login', 'is_staff', 'is_superuser', 'groups', 'user_permissions', ] list_filter = ['is_active', 'groups', ] - list_display = ['username', 'is_active', 'get_groups', ] + list_display = ['username', 'get_complete_name', 'is_active', 'get_groups', ] admin.site.register(FrontendUser, FrontendUserAdmin) @@ -37,7 +37,7 @@ class EditorAdmin(SeparateUserAdminBase): exclude = [] readonly_fields = ['date_joined', 'last_login', 'is_staff', 'is_superuser', 'user_permissions', ] list_filter = ['is_active', 'groups', ] - list_display = ['username', 'is_active', 'get_groups', ] + list_display = ['username', 'get_complete_name', 'is_active', 'get_groups', ] admin.site.register(Editor, EditorAdmin) diff --git a/separate_users/models.py b/separate_users/models.py index 8198c41..d845abe 100644 --- a/separate_users/models.py +++ b/separate_users/models.py @@ -48,6 +48,11 @@ def get_groups(self): get_groups.short_description = ("Groups") + def get_complete_name(self): + return '{} {}'.format(self.first_name, self.last_name) + + get_complete_name.short_description = ("Name") + class FrontendUser(SeparateUserBase, UserModel):