嗨,这是我在 models.py 中添加的特定行
billingMonth2 = models.DateTimeField()
这就是 makemigrations 中发生的事情,我想我添加了一个不可为空的字段,所以我尝试定义一个默认值:
You are trying to add a non-nullable field 'billingMonth' to bills
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: 1
Please enter the default value now, as valid Python
The datetime and django.utils.timezone modules …Run Code Online (Sandbox Code Playgroud)