我正在启动一个新的django项目,像往常一样,我在我安装的应用程序中设置了south。
然后我需要一些eav来在模型中存储一些字段,我找到了一个能做我想做的事情的应用程序,那就是django-eav ( https://github.com/mvpdev/django-eav )。
但现在我面临一个问题,因为south抱怨不知道如何与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,我试图在不放弃这两个项目的任何一个的情况下解决这个问题。
有人能帮我吗?谢谢
发布于 2012-04-14 13:44:32
我找到的最好的答案是来自http://south.aeracode.org/docs/settings.html#setting-south-migration-modules
它建议您在settings.py中设置add a SOUTH_MIGRATION_MODULES dict,并将应用程序映射到一个不存在模块
SOUTH_MIGRATION_MODULES = {
'eav': 'ignore',
}发布于 2011-09-16 00:19:56
看看github,django-eav似乎并没有处于非常活跃的开发阶段。如果它的工作方式与您希望的一样,并且您不希望更改其数据模型,则不需要对其应用South。South可以很好地管理一些应用,而不是其他应用。
在你正在构建和修改的应用程序上一定要使用South。但是对于一个稳定的库,我很少费心。
发布于 2011-09-16 16:28:21
我想我找到了一个可能的解决方案。
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"])现在它起作用了。
https://stackoverflow.com/questions/7434017
复制相似问题