在执行python manage.py makemigrations时报错:

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

执行python manage.py makemigrations时报错TypeError: __init__() missing 1 required positional argument: 'on_delete'-LMLPHP

解决方法:

执行python manage.py makemigrations时报错TypeError: __init__() missing 1 required positional argument: 'on_delete'-LMLPHP

在连接外键时加上:

on_delete=models.CASCADE
05-04 12:24