Search code examples
djangosaleor

add a field to a Django model


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


Solution

  • from ..account.models import User
    
    account_user = models.ForeignKey(
    User,
    related_name="products",
    on_delete=models.CASCADE)