Django: Using Third party app as a django app -
earlier using django-taggit app virtual environment. need add custom field foreign key(profile
) model tag
of taggit app. moved taggit app virtual env apps directory , cross check path of app:
<module 'taggit' '/home/user/vir/poll/taggit/__init__.pyc'>
tagging seems working fine @ point.
in tag
model made following changes:
from profile.models import profile class tag(tagbase): profile = models.foreignkey(profile) class meta: verbose_name = _("tag") verbose_name_plural = _("tags")
while running schemamigration
i'm getting error:
importerror: cannot import name profile
any insight issue ?
maybe use tag
inside profile.models
, reason there circular import , python can handle it.
if want prevent circular import problems can remove from profile.models import profile
, use lazy model definition of foreign key:
class tag(tagbase): profile = models.foreignkey('profile.profile')
i don't know details in situation think use django-taggit incorrectly. default tags use generic foreign key , don't need explicit foreign key point model http://django-taggit.readthedocs.org/en/latest/getting_started.html.
Comments
Post a Comment