4π
β
A template tag is just a way to use Python within a template. One possible soultion is to wrap unit_cost in another function so that itβs untouched. This is just one way i.e.
In your tags:
def multiply_cost(value):
return value*100
register.filter('multiply_cost', multiply_cost)
Then:
({{ "Micro"|unit_cost:100|multiply_cost }}p per message)
This will give: value as x.x as required. You can expand on this, for example pass in a multiply by arg etc, but for get the idea π
π€Glyn Jackson
1π
Just multiply the value by 100:
def unit_cost(value, arg):
# ...
return unit_cost*100
π€Burhan Khalid
- [Django]-How can I set salt for bcrypt.hashpw?
- [Django]-Make a One to Many Relation in django
- [Django]-PyCharm and Django Shell Networking
- [Django]-How do you use django-datatable-view
Source:stackexchange.com