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

Commit

Permalink
Change admin display of Avatar (#821)
Browse files Browse the repository at this point in the history
* Change admin display of avatar

* code climate fixes

* Merge branch 'master' into avatar_admin

* Merge branch 'master' into avatar_admin
  • Loading branch information
riaJha97 authored and TheseusGrey committed Sep 26, 2018
1 parent ec27ef2 commit f3c320b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions aimmo/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.contrib import admin

from models import Avatar, Game


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

admin.site.register(Avatar)

class AvatarDataAdmin(admin.ModelAdmin):
list_display = ['id', 'game_identifier', 'game_name', 'owner_name']

def owner_name(self, obj):
return obj.owner.first_name

def game_name(self, obj):
return obj.game.name

def game_identifier(self, obj):
return obj.game.id


admin.site.register(Game, GameDataAdmin)
admin.site.register(Avatar, AvatarDataAdmin)

0 comments on commit f3c320b

Please sign in to comment.