Malina Dale
Malina Dale

Reputation: 173

How to sum variabiles in Jinja template

I want to print sum of two values in jinja in the last table data tag

{% for product in invoice.all %}
            <tr>
                <td>{{product.quantity}}</td>
                <td>{{product.unit_price}}</td>
                <td>{{product.quantity + product.unit_price}}</td>
            </tr>
 {% endfor %}

What is the proper way of doing this. Thanks in advance

Upvotes: 0

Views: 596

Answers (1)

Tanmoy Sarkar
Tanmoy Sarkar

Reputation: 19

You can add by {{ product.quantity|add:product_unit_price }}

Upvotes: 2

Related Questions