You are trying to add a non-nullable field 'new_field' to userprofile without a default

前端 未结 16 1359
北恋
北恋 2020-11-30 19:27

I know that from Django 1.7 I don\'t need to use South or any other migration system, so I am just using simple command python manage.py makemigrations

16条回答
  •  星月不相逢
    2020-11-30 20:14

    In models.py

    class UserProfile(models.Model): user = models.OneToOneField(User) website = models.URLField(blank=True) new_field = models.CharField(max_length=140, default="some_value")

    You need to add some values as default.

提交回复
热议问题