Add v2 relational domain foundations with import run/file models
This commit is contained in:
@ -5,9 +5,9 @@ from .models import PlayerSeason, PlayerSeasonStats
|
||||
|
||||
@admin.register(PlayerSeason)
|
||||
class PlayerSeasonAdmin(admin.ModelAdmin):
|
||||
list_display = ("player", "season", "team", "competition", "games_played", "minutes_played")
|
||||
list_display = ("player", "season", "source_uid", "team", "competition", "games_played", "minutes_played")
|
||||
list_filter = ("season", "competition")
|
||||
search_fields = ("player__full_name", "team__name", "competition__name", "season__label")
|
||||
search_fields = ("player__full_name", "team__name", "competition__name", "season__label", "source_uid")
|
||||
|
||||
|
||||
@admin.register(PlayerSeasonStats)
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.2.12 on 2026-03-13 12:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('competitions', '0003_competition_source_uid_season_source_uid_and_more'),
|
||||
('players', '0006_player_source_uid_and_more'),
|
||||
('stats', '0002_playerseasonstats_search_indexes'),
|
||||
('teams', '0002_team_source_uid_team_teams_team_source__940258_idx'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='playerseason',
|
||||
name='source_uid',
|
||||
field=models.CharField(blank=True, max_length=160, null=True, unique=True),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='playerseason',
|
||||
index=models.Index(fields=['source_uid'], name='stats_playe_source__57b701_idx'),
|
||||
),
|
||||
]
|
||||
@ -4,6 +4,7 @@ from django.db import models
|
||||
class PlayerSeason(models.Model):
|
||||
player = models.ForeignKey("players.Player", on_delete=models.CASCADE, related_name="player_seasons")
|
||||
season = models.ForeignKey("competitions.Season", on_delete=models.CASCADE, related_name="player_seasons")
|
||||
source_uid = models.CharField(max_length=160, blank=True, null=True, unique=True)
|
||||
team = models.ForeignKey(
|
||||
"teams.Team",
|
||||
on_delete=models.SET_NULL,
|
||||
@ -31,6 +32,7 @@ class PlayerSeason(models.Model):
|
||||
)
|
||||
]
|
||||
indexes = [
|
||||
models.Index(fields=["source_uid"]),
|
||||
models.Index(fields=["player", "season"]),
|
||||
models.Index(fields=["season", "team"]),
|
||||
models.Index(fields=["season", "competition"]),
|
||||
|
||||
Reference in New Issue
Block a user