0
我有五款車型:充分利用Django的model.ForeignKey場Django管理對象的過濾列表
Class League(models.Model):
type = models.CharField(max_length=30)
class Team(models.Model):
name = models.CharField(max_length=30)
league = models.ForeignKey(max_length=30)
class Player(models.Model):
name = models.CharField(max_length=30)
league = models.ForeignKey(Team)
class Fixture(models.Model):
date = models.DateField();
league = models.ForeignKey(League)
team_1 = models.ForeignKey(Team, rel="home")
team_2 = models.ForeignKey(Team, rel="away")
class Team1_score(models.Model):
fixture = models.ForiegnKey(Fixture)
player = models.ForeignKey(Player)
score = models.IntegerField(max_length=4)
現在Django管理,當我在編輯有關編輯TEAM1_SCORE細節,我只是想成爲有關從團隊1個玩家列出這是我在管理
class Team1ScoreInline(models.TabularInline):
extra = 1
class Fixture(models.Admin):
inlines = [Team1ScoreInline, Team2ScoreInline]
正在做,但它會列出我的在數據庫中的所有玩家顯示當我選擇一個玩家添加到記分卡。