目录
class User(AbstractUser):
"""用户表"""
job = models.ManyToManyField(to='job.Job', through='Collect', through_fields=('user', 'job'))
class Job(BaseModel):
"""岗位表"""
user = models.ManyToManyField(to='user.User', through='user.Collect', through_fields=('job', 'user'))
class Collect(models.Model):
"""收藏表"""
user = models.ForeignKey('User', to_field='id', on_delete=models.CASCADE)
job = models.ForeignKey("job.Job",to_field='id',on_delete=models.CASCADE)
django2版本以后foreignkey必须加on_delete参数