Django how to add 2 or more filters

Viewed 45

How to add multiple filters in Django

{{ order.get_cart_total | add:500 | floatformat:2 }}
1 Answers

You add these in a "chain", where the output of the first filter is filtered again, so:

{{ order.get_cart_total|add:500|floatformat:2 }}

That being said, It might be better to add 500 to the result in the get_cart_total method of the order, or in another method. A template is normally used to specify how data is rendered, business logic is normally written in the models and in the views.

Related