串行器关系

class Member(models.Model):
 
    teamid = models.ForeignKey(Teams,db_column='teamid', 
verbose_name=u'队次', help_text=u"队次",
on_delete=models.SET_NULL, related_name="member_team", 
null = True, blank=True)

class Teams(models.Model):
    teamMember = models.ManyToManyField(User, verbose_name="考察队员", 
      help_text="考察队员",related_name="teams_sysuser",
     through="Member", through_fields=("team", "user"))

#序列化的时候可以这样写
member_team =serializers.StringRelatedField(many=True)

#还不完善,在学习

你可能感兴趣的:(串行器关系)