在受到django-oscar的启发后,我试图将cmsplugin放入其主应用程序中。但是,在执行schemamigration --initial
之后,我无法在Django CMS中使用该插件。
DatabaseError: (1146, "Table 'devel_test.cmsplugin_galleries_gallerycontainer_galleries' doesn't exist")
class Gallery(models.Model):
title = models.CharField(_(u'title'), max_length=200)
description = models.TextField(_(u'description'), blank=True)
image_folder = FilerFolderField(verbose_name=_(u'image folder'))
is_video = models.BooleanField(_(u'is video content'), default=False)
snippet = models.TextField(_(u'video snippet'))
class Meta:
verbose_name = _(u'Gallery')
verbose_name_plural = _(u'Galleries')
class GalleryImage(models.Model):
gallery = models.ForeignKey(Gallery, verbose_name=_(u'gallery'))
title = models.CharField(_(u'title'), max_length=200, blank=True)
src = FilerImageField(verbose_name=_(u'image'))
class GalleryContainer(CMSPlugin):
title = models.CharField(_(u'title'), max_length=200)
galleries = models.ManyToManyField(Gallery, verbose_name=_(u'galleries'))
def __unicode__(self):
return u'%s' % self.title
由于我可以使用syncdb --all
正确运行它,我做错了什么?
备注:
使用syncdb
创建一个名为cmsplugin_galleries_gallerycontainer_galleries
但使用 south 的表,表名为cmsplugin_gallerycontainer_galleries
由于
答案 0 :(得分:0)
由于没有其他选择,我跟踪@daigorocub提示并替换了迁移文件中cmsplugin_gallerycontainer_galleries
的所有shorten_name实例
m2m_table_name = db.shorten_name(u'cmsplugin_gallerycontainer_galleries')
到
m2m_table_name = db.shorten_name(u'cmsplugin_galleries_gallerycontainer_galleries')
此问题已在django cms 3.0(https://github.com/divio/django-cms/issues/2291#ref-pullrequest-26529456)的开发分支中修复,但由于我的版本较旧,因此无法更新到最新分支
谢谢你们的帮助!