```
class Product(models.Model):
    name = models.CharField(max_length=80)
    product_image = models.ImageField(upload_to='product/product/images/%Y/%m/%d/', blank=True)
    price = models.IntegerField()

```

```
class Cart(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    created_at = models.DateTimeField(auto_now_add=True)

```

```
class CartItem(models.Model):
  item = models.ForeignKey(Product, null=True, on_delete=models.CASCADE)
  qty = models.IntegerField(default=1)
  cart = models.ForeignKey(Cart, null=True, on_delete=models.CASCADE)

```

I'm trying to get an automatic total price that will be shown on check out page. I want to add a 'total\_price' column on CartItem model and set the default 'item.price \* qty', but when I tried to add this line to the class:

```
  total_price = models.IntegerField(default=item.price)

```

since default value for qty is 1 but I got AttributeError: 'ForeignKey' object has no attribute 'price' error.

I also tried add this to the class:

```
@property
def total_price(self):
  item = self.object.get(product=self.item)
  return self.item.price

```

but I'm not sure which model will have the property? And when I added this method, I lost total\_price column which I set its default as 0. I apologize for the lacking quality of solutions!