我有以下型号:
class Person(models.Model):
title=models.CharField(max_length=250,unique=True)
cost=models.CharField(max_length=100)
desc=models.TextField(blank=True)
color=models.CharField(max_length=1000)
image_urls=models.CharField(max_length=1000)
source=models.CharField(max_length=250,unique=True)
category=models.CharField(max_length=1000)
size=models.CharField(max_length=1000)
fit=models.CharField(max_length=1000)
fabric=models.CharField(max_length=1000)
type_dress=models.CharField(max_length=1000)
currency=models.CharField(max_length=1000)
advertiser=models.CharField(max_length=1000)
class Meta:
unique_together=('title','source')
def __unicode__(self):
return self.title
我希望我的标题和来源像复合主键一样是唯一的,但是当我执行上述更改时,它会在运行django manage.py syncdb..
NameError: name 'unique_together' is not defined