1
執行:不能凍結場
python ./mamage.py schemamigration --initial<br>
它給了我一個錯誤:
! Cannot freeze field 'exam.question.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
自定義字段類:
from django.utils.translation import ugettext_lazy as _
from taggit.forms import TagField
from taggit.managers import TaggableManager
from widgets import TagAutocomplete
class TaggableManagerAutocomplete(TaggableManager):
def formfield(self, form_class=TagField, **kwargs):
field = super(TaggableManagerAutocomplete, self).formfield(form_class, **kwargs)
field.widget = TagAutocomplete()
return field
我的問題是如何定義("null": ["null", {{"ignore_if": "name"}],)
模型這一行的.py。
from south.modelsinspector import add_introspection_rules
from taggit_autocomplete_modified.managers import TaggableManagerAutocomplete
add_introspection_rules(
[
(
(TaggableManagerAutocomplete,),
[],
{
"null": ["null", {{"ignore_if": "name"}],
},
),
],
["^taggit_autocomplete_modified\.managers\.TaggableManagerAutocomplete"])
如果不能確定這條線,我會得到另一個錯誤:
TypeError: __init__() got an unexpected keyword argument 'null'
有沒有解決這個問題?現在正是這個問題(試圖覆蓋TaggableManager) – straykiwi 2015-03-30 21:33:16