案例一: from django.db import models class Book(models.Model): name = models.CharField(max_length=33) # 创建数据,当然不在此处设置,制只做示例演示 # models.Book.objects.create(name='书名') class Author(models.Model): name = models.CharField(max_length=33) # Django此时帮我们生成第三张表…
杂交(自定义第三张表+ManyToManyField) # modles.py class Boy(models.Model): name = models.CharField(max_length=32) class Girl(models.Model): name = models.CharField(max_length=32) m = models.ManyToManyField('Boy',through='Love',through_fields=('b','g')) # 只让其生成…