Django的外键使用
from django.db import models # Create your models here. class Category(models.Model): name = models.CharField(max_length=100) class Article(models.Model): title = models.CharField(max_length=100) content = models.TextField() # 是由Category影响Article category = models.ForeignKey(\'Category\',on_delete=models.CASCADE,related_name="article_category")
https://blog.csdn.net/xujin0/article/details/83552349
通过主表查询子表、通过子表查询主表、字段related_name的作用:
https://blog.csdn.net/hpu_yly_bj/article/details/78939748