我是django的新手,在将Django auth
模型直接集成到应用程序模型中时遇到了问题,将其称为:
class Question(models.Model):
question_text = models.CharField(max_length=200, blank=False)
pup_date = models.DateField('date_published',auto_now=True)
author = models.ForeignKey(User, on_delete=models.CASCADE)
但是尝试运行python manage.py makemigrations
时会出现以下错误
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
因此,请您帮帮我,我不需要创建自定义用户模型。
致谢
答案 0 :(得分:-1)
question_text = models.CharField(max_length=200, null=True, blank=True)