进行数据库迁移的时候,显示  TypeError: __init__() missing 1 required positional argument: 'on_delete'

图示:

python进行数据库迁移的时候显示(TypeError: __init__() missing 1 required positional argument: 'on_delete')

出现原因:

在django2.0后,定义外键和一对一关系的时候需要加on_delete选项,此参数为了避免两个表里的数据不一致问题,不然会报错:
TypeError: __init__() missing 1 required positional argument: 'on_delete'

修改:

python进行数据库迁移的时候显示(TypeError: __init__() missing 1 required positional argument: 'on_delete')

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-22
  • 2022-12-23
  • 2021-09-03
猜你喜欢
  • 2021-07-09
  • 2022-03-10
  • 2022-12-23
  • 2021-07-05
相关资源
相似解决方案