在创建外键的时候遇到报错:
TypeError: __init__() missing 1 required positional argument: 'on_delete'
查询一番后发现Django2.0版本创建外键时需要在后面加上on_delete
class Car(models.Model):
manufacturer = models.ForeignKey(
'Manufacturer',
on_delete=models.CASCADE,
)
#...```
添加后问题解决