I have below models,
class Model_1(models.Model)
price = models.IntergerField()
class Model_2(models.Model)
product=models.ForeignKey(Model_1)
quantity = models.IntergerField()
@property
def totalprice(self):
return self.quantity * self.product__price
arr = [obj1,obj2,obj3] # objects of Model_2
I am getting error that arr objects has no attribute 'product__price'