Django关联数据库时报错TypeError: __init__() missing 1 required positional argument: 'on_delete'
sgrade = models.ForeignKey("Grades",)
执行python manage.py makemigrations后出现
TypeError: __init__() missing 1 required positional argument: 'on_delete'
缺少一个参数 'on_delete'
加上就好了
sgrade = models.ForeignKey("Grades",on_delete=models.CASCADE,)