【问题标题】:django-taggit-autocomplete and southdjango-taggit-autocomplete 和南
【发布时间】:2015-08-11 23:47:20
【问题描述】:

我使用 django-taggit-autocomplete,但是在进行方案迁移时,出现错误

 ! Cannot freeze field 'main.hotels.tags'
 ! (this field has class taggit_autocomplete_modified.managers.TaggableManagerAutocomplete)
 ! Cannot freeze field 'main.rooms.tags'
 ! (this field has class taggit_autocomplete_modified.managers.TaggableManagerAutocomplete)

 ! 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

所以我搜索了一下,发现 django-taggit-autocomplete-modified 应该可以解决问题,但它没有。

解决此问题的最佳方法是什么?

【问题讨论】:

    标签: django django-south django-taggit


    【解决方案1】:

    我终于解决了在models.py中添加以下代码的问题

    from south.modelsinspector import add_ignored_fields
    add_ignored_fields(["^taggit_autocomplete\.managers"])
    

    【讨论】:

    • 如果这是你的正确答案,最好选择正确答案
    【解决方案2】:

    以下是@Douglish 自己的回答的一些背景信息——取自South's documentation

    如果您知道某些字段不需要,您可以完全忽略它们。 例如,django-taggit 有一个实际上显示为 假字段(这使得使用它的 API 更好,但令人困惑 南无止境)。我们附带的 django-taggit 模块包含这个 忽略它的规则:

    from south.modelsinspector import add_ignored_fields
    add_ignored_fields(["^taggit\.managers"])
    

    【讨论】:

    • 请从链接中添加一些内容。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-21
    • 2021-08-22
    • 2019-03-12
    • 2012-10-07
    • 2011-07-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多