我會告訴你從哪裏開始:
class Team (models.Model):
players = models.ManyToManyField(Player,...)
attribute1
atribtue2
atribute3
class Player (models.Model):
name = models.CharField(max_length=100, default='none', verbose_name=_(u'Player Name'))
team = models.ForeignKey(Team, related_name = "")
class Match (models.Model)
date = models.DateTimeField(auto_now_add=True, verbose_name=_(u'Date'))
attribute1 = models.CharField(max_length=100)
attribute2 = models.IntegerField(values)
homeTeam = models.ForeignKey(Team, related_name="Home Team")
visitorTeam = models.ForeignKey(Team,related_name='Visitor Team')
players = models.ManyToManyField(Player, blank=True, null=True, verbose_name=_(u'sitio web'), related_name=u'product_site')
球員和比賽我會告訴你,你怎麼能這樣做的關係,foreignkeys和manytomanys,您可以添加玩家t的變量o商店所有玩過的比賽...你必須在比賽中創建一些屬性來存儲目標,故障,卡.....
我沒有嘗試這個代碼,但我認爲這可以讓你在良好的方向
可以粘貼示例代碼? –
嗨,除了我的模型,我基本上只有一個fieldset現在顯示我的表單... –