我开始得到:
OperationalError at /admin/contact_us/contact_details/
(1054, "Unknown column 'contact_us_contact_details.address_title' in 'field list'")
Request Method: GET
Request URL: http://216.119.153.206/admin/contact_us/contact_details/
Django Version: 1.4 pre-alpha SVN-16280
Exception Type: OperationalError
Exception Value:
(1054, "Unknown column 'contact_us_contact_details.address_title' in 'field list'")
Exception Location: /opt/python2.7/lib/python2.7/site-packages/MySQL_python-1.2.3-py2.7-linux-x86_64.egg/MySQLdb/connections.py in defaulterrorhandler, line 36
我的模型看起来像(单例):
@I18n('address_title','contact_info','contact_form_header','accepted_message','error_message')
class Contact_details(models.Model):
class Meta:
verbose_name = 'Contact Details'
verbose_name_plural = 'Contact Details'
address_title = models.CharField(max_length=255,blank=True,null=True)
title_font = models.ForeignKey(Font,blank=True,null=True)
contact_form_header = models.CharField(max_length=255,blank=True,null=True)
contact_form_header_use_title_font = models.NullBooleanField(default=True,blank=True,null=True)
google_map_link = models.TextField(blank=True,null=True)
contact_info = models.TextField(blank=True,null=True)
accepted_message = models.TextField(blank=True)
error_message = models.TextField(blank=True)
def save(self):
self.id = 1
super(Contact_details,self).save()
def delete(self):
pass
def __unicode__(self):
return 'Contact Us Details'
我正在使用 South 将数据库迁移到生产环境。当我使用 MySQL Workbench 检查 contact_us_contact_details 表时,我看到address_title_en 和 address_title_fr都存在(仅支持的语言)
任何人都知道这个错误来自哪里?当我开始遇到这个问题时,我正在安装 Haystack 和 Whoosh。
编辑:出于测试目的,我将 address_title 列添加到 MySQL 数据库中并且它有效(它停止在该列上失败并开始在下一列上失败)