python - Dynamically generate one value in a Django include tag -
i have include tag works fine if hard code values, need generate on fly using {{ foo_counter }}
. doing way:
{% include "template.html" foo=var1 pos="var_num_{{foo_counter.next}}" bool="0" %}
just outputs string without interpreting variable (as expect). i've tried combinations of tag around either template error or same output.
you can use django's inbuilt add
filter: https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#add
{% include "template.html" foo=var1 pos="var_num_"|add:foo_counter.next bool="0" %}
Comments
Post a Comment