我有一个与名为SpecialInterest的模型相关的Cruise商品类。我现在意识到我在LandOffer模型(其他地方)中发生了同样的事情。所以我想摆脱巡航.SpecialInterest并将其替换为land.SpecialInterest。
这是我的错误: 错误:一个或多个模型未验证: cruise.cruiseoffer:'special_interest'与模型land.models.SpecialInterest有一个m2m关系,它没有安装或是抽象的。
我删除了CruiseOffer表,但是当我syncdb时,我失败了。
帮助?
class CruiseOffer(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=300) # Field name made lowercase.
name_enca = models.CharField(max_length=300, blank=True) # Field name made lowercase.
name_frca = models.CharField(max_length=300, blank=True) # Field name made lowercase.
supplier = models.ForeignKey('CruiseSupplier')
#special_interest = models.ManyToManyField('SpecialInterest')
special_interest = models.ManyToManyField('land.models.SpecialInterest')
def __unicode__(self):
return "%6d %s" % (self.id, self.name,)
答案 0 :(得分:1)
正确的语法是:
from land.models import SpecialInterest
...
class Crui...
...
special_interest = models.ManyToManyField(SpecialInterest)