I am using model inheritance in my models.py. This is my code:
class Email(models.Model):
stuff = models.CharField(max_length=40, blank=True,
null=True, default="")
class TypeMod(Email):
pass
When I run makemigrations, I get the following message although I have set the default value for all of my fields in the Email model:
You are trying to add a non-nullable field 'id' to typemod 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 with a null value for this column) 2) Quit, and let me add a default in models.py
What am I doing wrong?!
Well I figured it out! For anyone who has the same issue, I am using vagrant and this project is running on a vm.So the problem was that the parent model was not abstract before, so a table was made in the database for the parent model. So when I switched to abstract, the table was still there. The way I solved it was that I ran "vagrant distroy" and restarted the vm.