DjangoModels修改后出现You are trying to add a non-nullable field 'download' to book without a default; we can't do that (the database needs something to populate existing rows). Please select a fix:

这个问题是在模型中新添加的,在原来已经有的表单中没有值。所以在新添加的值得括号中添加

  1 download = models.ForeignKey(Download, on_delete=models.CASCADE, null=True)


然后

  1 python manage.py makemigrations
  2 
  3 python manage.py migrate
原文地址:https://www.cnblogs.com/rstz/p/13271586.html