Sunday, 15 September 2013

Incrementing list items in jinja2 templates (appengine)

Incrementing list items in jinja2 templates (appengine)

I have a list of values in my template, which I need to increment based on
some conditions. Something like this:
{% set samplelist=[0,0,0] %}
{% if condition %}
<p>some text</p>
{% set samplelist[0]=samplelist[0]+listpassedbymainfile[0]
{% endif %}
I keep getting this error when I try to run the above code:
TemplateSyntaxError: expected token '=', got '['
Is this not supported, if so, is there a work around ?

No comments:

Post a Comment