【发布时间】:2015-03-16 17:35:42
【问题描述】:
我正在尝试在我的项目中使用 django-orderedmodel (https://github.com/kirelagin/django-orderedmodel)。
运行 makemigrations 不起作用:
You are trying to add a non-nullable field 'order' to slide without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows)
2) Quit, and let me add a default in models.py
Select an option:
我想知道我做错了什么。谢谢
【问题讨论】:
-
你没有做错什么。您的表中有现有行,并且您正在尝试添加一个没有默认值但不能为空的字段。
-
它让您选择如何解决它。选择一个选项。
标签: python django database field non-nullable