執行python manage.py makemigrations時報錯:__init__() missing 1 required positional argument: 'on_delete'

在執行python manage.py makemigrations時報錯:

TypeError: __init__() missing 1 required positional argument: 'on_delete'

解決方法:

            

在連接外鍵時加上:

on_delete=models.CASCADE

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章