《Django REST framework 入门到精通》视频课程上线了,全网稀缺资源,深度源码剖析,进阶高手之路!点击链接查看详情


user_image
By  亮亮跄跄only    On   2018年12月17日 23:33

from django.db import models # Create your models here. class Person(models.Model): name = models.CharField(max_length=128) def __str__(self): return self.name class Group(models.Model): name = models.CharField(max_length=128) members = models.ManyToManyField(Person,through='Membership') def __str__(self): return self.name class Membership(models.Model): person = models.ForeignKey(Person,on_delete=models.CASCADE) group = models.ForeignKey(Group,on_delete=models.CASCADE) data_join=models.DateField() invite_reason = models.CharField(max_length=200)