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

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

However, all I get is this error:

    You are trying to add a non-nullable field 'new_field' to userprofile without a default;
    we can't do that (the database needs something to populate existing rows).

Here is models.py:

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

What are options?

You need to provide a default value:

    new_field = models.CharField(max_length=140, default='SOME STRING')

From: stackoverflow.com/q/26185687

Back to homepage or read more recommendations: