add a field to a Django model

202 views Asked by At

I am working on this project: https://github.com/mirumee/saleor

I want to add a "user_id" column to the product table. So, I added the following code to line 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,
 )

However, Django says "NameError: name 'Account_User' is not defined". How could I solve this problem? Thanks

1

There are 1 answers

5
Surya Pratap Rana On BEST ANSWER
from ..account.models import User

account_user = models.ForeignKey(
User,
related_name="products",
on_delete=models.CASCADE)