I want to create a list and append values to it throughout the template. Before having to create a custom filter or something like that I'd like to know how this is done with vanilla Jinja.
This is the only way I could get this to work:
{%- set mylist = [] -%}
{# create manipulate variables... #}
{% set mylist = mylist.append(some_var) %}
{# create manipulate variables... #}
{% set mylist = mylist.append(some_other_var) %}
Do I really need to use set and reassign like this? I'd prefer to just to {% mylist.append(some_other_var) %}, but it looks like that isn't possible?
Also, how can I do multiple appends more concisely (if I don't have another list to loop over). I'd like to do something like this (which does not work):
{%
mylist.append(some_var)
mylist.append(some_other_var)
mylist.append(sdfsdfs)
%}