Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Commit f3c320b

Browse files
riaJha97TheseusGrey
authored andcommitted
Change admin display of Avatar (#821)
* Change admin display of avatar * code climate fixes * Merge branch 'master' into avatar_admin * Merge branch 'master' into avatar_admin
1 parent ec27ef2 commit f3c320b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

aimmo/admin.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from django.contrib import admin
2-
32
from models import Avatar, Game
43

54

@@ -11,5 +10,19 @@ class GameDataAdmin(admin.ModelAdmin):
1110
def players(self, obj):
1211
return "\n".join([u.first_name for u in obj.can_play.all()])
1312

14-
admin.site.register(Avatar)
13+
14+
class AvatarDataAdmin(admin.ModelAdmin):
15+
list_display = ['id', 'game_identifier', 'game_name', 'owner_name']
16+
17+
def owner_name(self, obj):
18+
return obj.owner.first_name
19+
20+
def game_name(self, obj):
21+
return obj.game.name
22+
23+
def game_identifier(self, obj):
24+
return obj.game.id
25+
26+
1527
admin.site.register(Game, GameDataAdmin)
28+
admin.site.register(Avatar, AvatarDataAdmin)

0 commit comments

Comments
 (0)