[英]Importing from views to models in Django
我在我的一個應用程序的models.py
有這樣的東西:
class Account(AbstractBaseUser):
email = models.EmailField(unique=True)
我想從另一個應用程序的views.py中導入一個類,如下所示:
from anotherapp.views import MyClass
問題出在anotherapp.views
文件的第一行,我導入了Account
類。 因此,當我想將MyClass
導入到models.py
文件中時,此錯誤會引發:
ImportError: cannot import name Account
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.