gottfried

导航

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,)

posted on 2018-06-02 14:39  gottfried  阅读(218)  评论(0编辑  收藏  举报