i would like to know how i can save a field i get from json as dict. to my database field. Currently i only get
'int' object is not callable
thank and regards
I think this is what you are trying to do:
decoded_balance = json.loads(check_balance)
user.acc_balance = decoded_balance["confirmed"]
user.save()
You already have the user, just update it's acc_balance field and save it.
Also, you might want to check how to parse json. For example, in this case you have something like this:
decoded_balance
# eg: {'confirmed': 2, 'unconfirmed': 3}
decoded_balance["confirmed"]
# 2
user.acc_balance('confirmed')? As the error says,acc_balanceis an integer, it does not know what to do with the 'confirmed' param that you are passing.update_or_createpart? Do you want to save the data in the user that you have asuser? If i understand correctly what you want is to save the confirmed value from decoded_balance to the user's acc_balance field. Is that correct?