问题
class Status(models.Model):
“””用于记录一些日常状态”””
u_id = models.OneToOneField(to = User, on_delete=models.CASCADE, verbose_name=”用户ID”)
check_in_time = models.DateField(auto_now = True)
def __str__(self):
return self.u_id.username
在新建了一个用户之后,表现出错误,莫名奇妙,根本调不好,并且也没有自动帮忙建立ID。
You are trying to add a non-nullable field ‘integral’ to profile without a default; we can’t do that (the database needs something to populate existing rows).
Please select a fix:
- Provide a one-off default now (will be set on all existing rows with a null value for this column)
- Quit, and let me add a default in models.py
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 边缘坐标のWasteland!
评论