django-eav 和南

发布于 2024-12-04 16:01:26 字数 950 浏览 2 评论 0 原文

我正在启动一个新的 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 我正在尝试解决这个问题而不放弃这两个项目中的任何一个。

有人可以帮助我吗? 谢谢

I'm starting a new django project and as usually i put south on my installed apps.

Then i need some kind of eav to store some fields in a model and i found an app that does exactly what i want, that is django-eav ( https://github.com/mvpdev/django-eav )

But now i'm facing a problem, because south complains that doesn't know how to work with 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

I'm reading this http://south.aeracode.org/docs/customfields.html and i'm trying to solve this problem without giving up any of the two projects.

Anyone could help me?
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

自控 2024-12-11 16:01:26

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

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

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

The best answer I found was from http://south.aeracode.org/docs/settings.html#setting-south-migration-modules

It suggests that you set add a SOUTH_MIGRATION_MODULES dict in settings.py, and map that app to a nonexistent module

SOUTH_MIGRATION_MODULES = {
    'eav': 'ignore',
}
情丝乱 2024-12-11 16:01:26

从 github 来看,django-eav 的开发似乎并不活跃。如果它按您想要的方式工作并且您不希望更改其数据模型,则不需要对其应用 South。 South 可以很好地管理某些应用程序,但不能管理其他应用程序。

一定要在您正在构建和修改的应用程序上使用 South。但对于一个稳定的库,我很少打扰。

Looking at github it appears that django-eav is not under very active development. If it's working as you want and you don't expect to change its data model, you don't need to apply South to it. South works fine managing some apps and not others.

Definitely use South on the apps that you're building and modifying. But for a stable library, I rarely bother.

蛮可爱 2024-12-11 16:01:26

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

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"])

现在它可以工作了。

I think i found one possible solution.

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

Next to my model i put this:

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

now it works.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文