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:

  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