【发布时间】:2014-03-20 06:17:47
【问题描述】:
我在 models.py 文件中有 2 个模型类:
class Certificate(models.Model):
comments = models.TextField(blank=True, default='')
generic_certificate = models.ForeignKey(GenericCertificate, related_name='certificates_awarded')
tag = models.ForeignKey('Tag', related_name='certificates_awarded', null=True, blank=True)
class GenericCertificate(CommonInfo):
CERTIFICATE_TYPE = (('C', 'system created'),
('U', 'user created'))
certificate_icon = models.ImageField(upload_to='certificate/icons', default='defaults/certificate.png')
certificate_type = models.CharField(choices=CERTIFICATE_TYPE, max_length=1, default='C')
template = models.FileField(upload_to='certificate/generic_templates')
他们在 django admin 中工作正常,但是当我添加一个模型类时,它开始在点击通用证书选项时出现错误:包含操作:South Migration 和 syncdb
异常类型:ProgrammingError
异常值:
关系“certificates_genericcertificate”不存在
第 1 行:从“certificates_genericcertificate”中选择 COUNT(*)
在同一个models.py中新添加的模型类
class PositionCertificate(models.Model):
rewardee = models.CharField(max_length=50, default = '0,0')
org_logo = models.CharField(max_length=50, default = '0,0')
tag_name = models.CharField(max_length=50, default = '0,0')
如何消除此错误?为什么会出现这个错误?
【问题讨论】:
-
你做过syncdb,架构迁移吗?
标签: django django-models django-south