Django (1.5)를 사용하여 3 열에서 UNIQUE
인덱스를 생성 할 수 없습니다. 내 모델의 모습은 다음과 같습니다.Django unique_together가 작동하지 않습니다
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
이 외래 키에서 작동하지 않는다는 버그 보고서를 보았지만 해결 된 것으로 보았습니다. 어떤 도움이 필요합니까?
필드 이름 대신 열 이름을 사용 해본 적이 있습니까? –
작동하지 않습니다. 오류가 발생합니다. "unique_together"는 존재하지 않는 필드 인 sectiune_id를 참조합니다. –