Я просто использую простую команду python manage.py makemigrations
Однако все, что я получаю, это ошибка:
You are trying to add a non-nullable field 'id' to contact_info without a default;
we can't do that (the database needs something to populate existing rows). Please select a fix:
1) Provide a one-off default now (will be set on all existing rows)
2) Quit, and let me add a default in models.py
Вот модели .py:
class Document(models.Model):
docfile = models.FileField(upload_to='documents/')
class contact_number(models.Model):
contact_numbers= models.CharField(max_length=13)
class contact_address(models.Model):
address = models.CharField(max_length=100)
city = models.CharField(max_length=50)
state = models.CharField(max_length=50)
zip = models.CharField(max_length=5)
class contact_info(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
email = models.EmailField()
contact_numbers=models.ManyToManyField(contact_number)
addresses=models.ManyToManyField(contact_address)