Adding Simple Custom Field to Django — How to Write South Introspection Rules

我怕爱的太早我们不能终老 提交于 2019-12-04 06:48:01

Simple answer: yes, the code should go in the models.py file where the field was defined. The correct code is:

from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^myapp\.models\.ColorField"])

Not sure why I was putting the project name in there.

You have to make sure that the path to the file is correct. The one you mention looks similar to one I am using, but the path is:

add_introspection_rules([], ["^colors\.fields\.ColorField"])
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!