Django模型和关系。错误

时间:2017-09-12 10:10:19

标签: django django-models

大家好我有一个简单的证据,证明我错过了使用模型和关系的东西 我有两个模型模型,一个是团队,可以有多个用户,一个用户可以是多个团队的一部分 以及一个获得名称并与团队相关联的项目

class Team(models.Model):
    member1 = models.ForeignKey(MyUser, blank= False)
    member2 = models.ForeignKey(MyUser, blank= False)
    member3 = models.ForeignKey(MyUser, blank= True)
    member4 = models.ForeignKey(MyUser, blank= True)
    member5 = models.ForeignKey(MyUser, blank= True)
    member6 = models.ForeignKey(MyUser, blank= True)


class Project(models.Model):
    name = models.CharField(max_length=250)
    team_id = models.ForeignKey(Team)

当我尝试迁移一个大错误时

website.Team.member1: (fields.E304) Reverse accessor for 'Team.member1' clashes with reverse accessor for 'Team.m
ember2'.
        HINT: Add or change a related_name argument to the definition for 'Team.member1' or 'Team.member2'.
website.Team.member1: (fields.E304) Reverse accessor for 'Team.member1' clashes with reverse accessor for 'Team.m
ember3'.
        HINT: Add or change a related_name argument to the definition for 'Team.member1' or 'Team.member3'.
website.Team.member1: (fields.E304) Reverse accessor for 'Team.member1' clashes with reverse accessor for 'Team.m
ember4'.

我知道我错过了什么,你能帮我解决一下吗? THX

0 个答案:

没有答案