【发布时间】:2014-08-18 14:44:28
【问题描述】:
之前我在虚拟环境中使用django-taggit 应用程序。现在我需要添加一个
自定义字段外键(Profile)为 taggit 应用程序的Tag 建模。
我将 taggit 应用程序从虚拟环境移动到应用程序目录并交叉检查该应用程序的路径:
<module 'taggit' from '/home/user/VIR/poll/taggit/__init__.pyc'>
此时标记似乎工作正常。
在Tag 模型中进行了以下更改:
from profile.models import Profile
class Tag(TagBase):
profile = models.ForeignKey(Profile)
class Meta:
verbose_name = _("Tag")
verbose_name_plural = _("Tags")
在运行schemamigration 时出现错误:
ImportError: cannot import name Profile
有什么见解要发布吗?
【问题讨论】:
-
建议您不要直接更改第 3 方模块。您可以做的一件事是,创建一个新模块,并将
Tag模型扩展为CustomTag或其他东西..
标签: django django-south