我有一个类,正在尝试向它添加一个新的FloatField
。Django希望使用默认值填充现有行(合理)。但是,它拒绝接受我给它的任何价值。
You are trying to add a non-nullable field 'FIELDNAME' to CLASS 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 with a null value for this column)
2) Quit, and let me add a default in models.py
Select an option: -1
Please select a valid option: -1
Please select a valid option: -1
Please select a valid option: float(-1)
Please select a valid option: -1.0
Please select a valid option: float(-1.0)
Please select a valid option:
如何让它接受我的价值?
您应该选择选项1,然后输入您的值
选择1后。它会要求提供默认值。
相关问题 更多 >
编程相关推荐