def get_ballances(user): res = {} if user: for wallet in user.wallet_set.all(): info = '%.8f' % wallet.amount if wallet.amount_blocked: info += ' (%.8f)' % wallet.amount_blocked res[wallet.currency.iso] = info return res def get_ballances_decimal(user): res = {} if user: for wallet in user.wallet_set.all(): info = wallet.amount blocked = wallet.amount_blocked res[wallet.currency.iso] = (info, blocked) return res