问题描述
我正在从事这个项目:https://github.com/mirumee/saleor
我想在产品表中添加一个“ user_id”列。 所以,我在第248行添加了以下代码 https://github.com/mirumee/saleor/blob/master/saleor/product/models.py#L248
account_user = models.ForeignKey(
Account_User,related_name="products",on_delete=models.CASCADE,)
但是,Django说“ NameError:名称'Account_User'未定义”。我该如何解决这个问题?谢谢
解决方法
from ..account.models import User
account_user = models.ForeignKey(
User,related_name="products",on_delete=models.CASCADE)