Skip to content

Commit

Permalink
fix(permission): fix admin page for UserGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
injoonH committed Jan 23, 2024
1 parent c71e9f2 commit 3a22da3
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions apps/user/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,34 @@ class ManualUserAdmin(MetaDataModelAdmin):


@admin.register(UserGroup)
class UserGroupAdmin(MetaDataModelAdmin):
class UserGroupAdmin(admin.ModelAdmin):
list_display = (
"user_id",
"group_id",
"user",
"nickname",
"email",
"group",
)
list_filter = ("group",)
search_fields = (
"user_id",
"group_id",
"user__id",
"user__profile__nickname",
"user__email",
)

@admin.display(description="닉네임")
def nickname(self, obj: UserGroup):
return obj.user.profile.nickname

@admin.display(description="이메일")
def email(self, obj: UserGroup):
return obj.user.email


@admin.register(Group)
class GroupAdmin(MetaDataModelAdmin):
class GroupAdmin(admin.ModelAdmin):
list_display = (
"group_id",
"name",
"description",
"is_official",
)
search_fields = (
"id",
"name",
)
search_fields = ("name",)

0 comments on commit 3a22da3

Please sign in to comment.