def get_all_price self goods self goodtobuy_set all all_price for good

1
2
3
4
5
6
def get_all_price(self):
goods = self.goodtobuy_set.all()
all_price = 0
for good in goods:
all_price += good.good_to.price * good.count
return all_price