5
嗨,我一直在尋找限制爲具體的數字一個ForeignKey關係的數量關係。
比方說,籃球隊只能有12人。Django的:限制在一對多關係
class Team(models.Model):
teamName = models.CharField(max_length = 20)
teamColors = models.CharField(max_length = 20)
... <and so forth>
class Player(models.Models):
team = models.ForeignKey(Team, **)
name = models.CharField(max_length = 20)
heightInches = models.IntegerField()
... <and so forth>
**是否有一個選項可以限制每隊最多12名球員?
任何額外創建一個python錯誤?