My models:
class CartItem(models.Model):
product = models.ForeignKey(Product, on_delete=models.CASCADE)
quantity = models.PositiveIntegerField(default=1)
item_price = models.DecimalField(max_digits=9, decimal_places=2,default=0.00)
class Cart(models.Model):
items = models.ManyToManyField(CartItem, blank=True)
total = models.DecimalField(max_digits=9, decimal_places=2,default=0.00)
When I add CartItem
instance to a cart and then look at the Cart
instance in admin dashboard, I see all the CartItem
instances instead of the one's I added to the cart. How do I fix it?
That's what I mean: