在 django 中创建迁移时出现错误
模型.py
class StateBuyers(models.Model):
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class Meta:
db_table = "states"
class CountiesBuyers (models.Model):
state = models.ForeignKey(StateBuyers, on_delete=models.CASCADE)
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class Meta:
db_table = "counties"
class CityBuyers (models.Model):
state = models.ForeignKey(StateBuyers, on_delete=models.CASCADE)
county = models.ForeignKey(CountiesBuyers, on_delete=models.CASCADE)
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
class Meta:
db_table = "cities"
也许在这里我有错误创建许多实例
class Buyers(models.Model):
name = models.CharField(max_length= 50)
state = models.ForeignKey(StateBuyers, related_name="Buyers", null=True, on_delete=models.CASCADE)
city = models.ForeignKey(CityBuyers, related_name="Buyers", null=True, on_delete=models.CASCADE)
phonenumber = models.CharField(max_length=15)
email = models.EmailField (max_length= 50)
notes = models.CharField(max_length=200)
def __unicode__(self):
return self.name
class Meta:
db_table = "buyers"
在迁移时抛出此错误任何想法?