Hi,
I’m currently on video 10 of the Building a Data Model part of Django Part 1, where Mosh resolves the circular dependency. After doing what Mosh does, and some other things I tried from the internet (wrapping Product in quotes, replacing Product with ‘store.Product’, etc), I am still thrown an error that prevents me from running the local server.
class Collection(models.Model):
title = models.CharField(max_length=255)
featured_product = models.ForeignKey(Product, on_delete=models.SET_NULL, null=True)
class Product(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
price = models.DecimalField(max_digits=6, decimal_places=2)
inventory = models.IntegerField()
last_update = models.DateTimeField(auto_now=True)
collection = models.ForeignKey(Collection, on_delete=models.PROTECT)
promotions = models.ManyToManyField(Promotion, related_name='Product_promo_set')
store.Collection.featured_product: (fields.E300) Field defines a relation with model 'Product', which is either not installed, or is abstract.
store.Product_promotions: (fields.E336) The model is used as an intermediate model by 'store.Product.promotions', but it does not have a foreign key to 'Product' or 'Promotion'.
Sorry if this is a noobie question, but thanks in advance for the help.