nilinswap
nilinswap

Reputation: 1514

what is the jinja2 equivalent of django add filter?

I am trying to render an html like below in jinja2

<div>
     <tr>
        <td>{{ row.a|add:b}}</td>
     </tr>
</div>

it throws error expected token 'end of print statement', got ':' . Above html was written for django template language. can someone help me with right substitute for jinja2?

Upvotes: 1

Views: 191

Answers (1)

wilspi
wilspi

Reputation: 46

You can use sum filter in jinja2
In your case [a,b]|sum should work

Check this: https://jinja.palletsprojects.com/en/2.11.x/templates/#sum

Upvotes: 2

Related Questions