Skip to content

Commit

Permalink
More admin stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjp93 committed Oct 13, 2024
1 parent e551a8f commit a90ba76
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion match/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,39 @@
from .models import EliteMonsterKillEvent


class ParticipantInline(admin.TabularInline):
model = Participant
fields = [
"puuid",
"riot_id_name",
"riot_id_tagline",
"champion_name",
"champ_experience",
"team_id",
"individual_position",
"team_position",
]
readonly_fields = fields
extra = 0
can_delete = False
show_change_link = True

def champion_name(self, obj):
if champ := obj.get_champion():
return champ.name
return "unknown"


@admin.register(Match)
class MatchAdmin(admin.ModelAdmin):
list_display = ("_id", "game_creation_dt", "queue_id", "game_version")
list_filter = ("platform_id", "major")
search_fields = (
"participants__summoner_name_simplified",
"participants__riot_id_name",
"participants__summoner_id",
"_id",
)
inlines = [ParticipantInline]
show_full_result_count = False
list_per_page = 30
paginator = CachedCountPaginator
Expand Down

0 comments on commit a90ba76

Please sign in to comment.