Make migration issue for a unique True filed.

14 views
Skip to first unread message

jisson varghese

unread,
Sep 26, 2018, 7:16:24 AM9/26/18
to Django users

I have model MyModel in app app1

class MyModel(models.Model):
     ...........
     name = models.CharField(max_length=10, unique=True)


I have made the following change,

class MyModel(models.Model):
     ...........
     name = models.CharField(max_length=10, unique=True, null=False)


python manage.py makemigrations  - create migration in file different app, and no there is no changes in that model.
When I tried manage.py makemigrations  app1 - No changes detected in app 'app1'




luca bocchi

unread,
Sep 26, 2018, 7:35:47 PM9/26/18
to Django users
fields are not null by default, so you don't need:

    null=False

that's why makemigrations doesn't detect changes in the MyModel model.

L
Reply all
Reply to author
Forward
0 new messages