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

前端 未结 16 1340
北恋
北恋 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:18

    In new_file add the boolean property null.

    new_field = models.CharField(max_length=140, null=True)
    

    after you run a ./manage.py syncdb for refresh the DB. and finally you run ./manage.py makemigrations and ./manage.py migrate

提交回复
热议问题