django-eav和南方

时间:2011-09-15 16:10:27

标签: python django entity-attribute-value django-south

我正在开始一个新的django项目,并且通常我把我的安装应用程序放在南方。

然后我需要某种eav来存储模型中的一些字段,我发现了一个完全符合我想要的应用程序,即django-eav(https://github.com/mvpdev/django-eav

但现在我遇到了一个问题,因为南方抱怨不知道如何使用django-eav。

! Cannot freeze field 'eav.attribute.slug'
! (this field has class eav.fields.EavSlugField)
! Cannot freeze field 'eav.attribute.datatype'
! (this field has class eav.fields.EavDatatypeField)

! South cannot introspect some fields; this is probably because they are custom
! fields. If they worked in 0.6 or below, this is because we have removed the
! models parser (it often broke things).
! To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork

我正在读这个http://south.aeracode.org/docs/customfields.html而我正试图解决这个问题而不放弃任何两个项目。

有人可以帮助我吗? 感谢

3 个答案:

答案 0 :(得分:2)

看看github看来,django-eav并没有得到非常积极的发展。如果它按照您的需要工作,并且您不希望更改其数据模型,则无需向其应用South。 South可以很好地管理一些应用程序,而不是其他应用程序。

绝对在您正在构建和修改的应用上使用South。但对于一个稳定的图书馆,我很少打扰。

答案 1 :(得分:2)

我想我找到了一个可能的解决方案。

http://south.aeracode.org/docs/customfields.html#field-name-patterns

在我的模型旁边,我把它放在:

from south.modelsinspector import add_ignored_fields
add_ignored_fields(["^eav\.fields\.EavDatatypeField"])
add_ignored_fields(["^eav\.fields\.EavSlugField"])

现在可行。

答案 2 :(得分:2)

我找到的最佳答案来自http://south.aeracode.org/docs/settings.html#setting-south-migration-modules

它建议您在settings.py中设置添加SOUTH_MIGRATION_MODULES dict,并将该应用映射到不存在的模块

SOUTH_MIGRATION_MODULES = {
    'eav': 'ignore',
}