Model:
class List(models.Model):
Lid = models.AutoField(primary_key=True)
Name = models.CharField(max_length=100)
addr1 = models.CharField(max_length=100)
addr2 = models.CharField(max_length=100)
City = models.CharField(max_length=40)
State = models.ForeignKey(State,blank=True, on_delete=models.DO_NOTHING, default=None,to_field="state",db_column="State") #,to_field="state",db_column="State"
Below is the error appears when tried to migrate,
IntegrityError( django.db.utils.IntegrityError: The row in table 'list' with primary key '1' has an invalid foreign key: list.State contains a value '' that does not have a corresponding value in State.state.
How to fix this issue? I did add those 'blank=True' and on_delete=models.DO_NOTHING after searching for a solution in google, still no luck.