Miscellany
public text v1 · immutable# Called like so ... lang_dict['1_month_payment']='1299'
# Change the one_month payment option...
lang_dict['1_month_payment'] = costCharge(lang_dict['1_month_payment'],2)
# Then just outputted to the template as
{{ lang_dict.1_month_payment }}
# Get the cent (string) figure, adjust by decimal place and return
# 1200 = 12.00
def costCharge(amount,decimals):
# Amount should be a string
amount = str(amount)
# get the length of the string
amount_length=int(len(amount))
# Length of the amount
fig_length = amount_length - int(decimals)
# Decimalize the currency value
amount = '%s.%s' % (amount[0: fig_length], amount[-2:])
return amount