1👍
✅
You are returning
{'statusCode': 200, 'calculation': <Calculations: Calculation for user>, 'customer': None}
and assigning it to calculation
.
Your calculation['calculation']
is Calculation
object which does not have __getitem__
method, so u can’t use it like dict
.
You should instead do
price = calculation['calculation'].purchase_price
Source:stackexchange.com