I have a query set that contains a number of transactions for a particular product.
transactions = Transaction.objects.filter(product__product_name_id = item.id)
Within this queryset contains a number of fields.
product
amount
price
transaction_date
I need to calculate the totals of the values in the amount fields.
The current query set is returning 2 amounts
from 2 `transactions'
Would it be sensible to loop through each transaction and add it to a list of something? or is there a better way?
list = []
for item in transactions:
amount = item.amount
list.append(amount)
Thanks