generated from bisco/codex-bootstrap
feat: bootstrap HoopScout scouting app
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import League, Player, PlayerGameLog, PlayerSeasonStat, Season, Team, UserProfile
|
||||
|
||||
|
||||
@admin.register(UserProfile)
|
||||
class UserProfileAdmin(admin.ModelAdmin):
|
||||
list_display = ("user", "role")
|
||||
list_filter = ("role",)
|
||||
search_fields = ("user__username",)
|
||||
|
||||
|
||||
@admin.register(League)
|
||||
class LeagueAdmin(admin.ModelAdmin):
|
||||
list_display = ("code", "name", "region", "country")
|
||||
list_filter = ("region", "country")
|
||||
search_fields = ("name", "code", "country")
|
||||
|
||||
|
||||
@admin.register(Team)
|
||||
class TeamAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "league", "country")
|
||||
list_filter = ("league", "country")
|
||||
search_fields = ("name",)
|
||||
|
||||
|
||||
@admin.register(Season)
|
||||
class SeasonAdmin(admin.ModelAdmin):
|
||||
list_display = ("label", "is_active")
|
||||
list_filter = ("is_active",)
|
||||
|
||||
|
||||
@admin.register(Player)
|
||||
class PlayerAdmin(admin.ModelAdmin):
|
||||
list_display = ("name", "position", "role", "current_team", "height_cm", "weight_kg", "nationality")
|
||||
list_filter = ("position", "current_team__league", "nationality")
|
||||
search_fields = ("first_name", "last_name", "role", "nationality")
|
||||
|
||||
|
||||
@admin.register(PlayerSeasonStat)
|
||||
class PlayerSeasonStatAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"player",
|
||||
"season",
|
||||
"league",
|
||||
"points_per_game",
|
||||
"assists_per_game",
|
||||
"rebounds_per_game",
|
||||
"efficiency_rating",
|
||||
)
|
||||
list_filter = ("season", "league")
|
||||
search_fields = ("player__first_name", "player__last_name")
|
||||
|
||||
|
||||
@admin.register(PlayerGameLog)
|
||||
class PlayerGameLogAdmin(admin.ModelAdmin):
|
||||
list_display = ("player", "game_date", "league", "opponent", "points", "assists", "rebounds", "efficiency_rating")
|
||||
list_filter = ("season", "league")
|
||||
search_fields = ("player__first_name", "player__last_name", "opponent")
|
||||
Reference in New Issue
Block a user