cart_product = CartProduct.objects.filter(cart_id=cart[0].id)
class CartProduct(models.Model):
cart_id = models.ForeignKey(Cart, null=True, blank=True, on_delete=models.CASCADE)
quantity = models.IntegerField()
product = models.ForeignKey(Product, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
def
str(self):
return str(
self.product.id)
Как получить product id int