我无法让 Django (1.5)UNIQUE
在 3 列上创建 MySQL 索引,即使我已经遵循了我在 SO 上找到的每一个建议。这是我的模型的样子:
class Loc(models.Model):
rand = models.IntegerField()
sectiune = models.ForeignKey(Sectiune)
numar = models.IntegerField()
pret = models.FloatField()
def __unicode__(self):
return str(self.sectiune.nume) + ': R' + str(self.rand) + ' L' + str(self.numar)
class Meta:
unique_together = (("rand","sectiune","numar"),)
我真的不明白怎么了。我看到了一个unique_together
不适用于外键的错误报告,但我也看到它已得到修复。有什么帮助吗?