I'm working on a sandboxed CMS so I can't run any pythonic code, other than versions of Jinja.
I am pulling my lists from a database where I split them based on having a field = a certain value.
{# rows = command to pull from db #}
{% set row_one = rows|selectattr('resource','equalto','One') %}
{% set row_two = rows|selectattr('resource','equalto','Two') %}
{# Sets my empty array #}
{% set newobj = [] %}
From here, console logging either Row one/two will result in showing me only those items that apply to their respective resource type.
My problem comes when I try to stuff those two in an array and then iterate over it to alternate the result.
Here is what I tried:
{% for row in rows %}
{% newObj.update(row_one[loop.index0], row_two[loop.index0] %}
{% endfor %}
This seems to be throwing an error on newObj
Unknown tag 'newobj'
I had it stop throwing the error by using :
{% for row in rows %}
{% set objs = newObj.update(marketingRows[loop.index0], salesRows[loop.index0], designRows[loop.index0]) %}
{% endfor %}
But this has proved to return nothing when console logging objs
.
My desired result
{# example input #}
row_one = ['1', '2', '3', '4']
row_two = ['a', 'b', 'c', 'd']
{# desired output #}
objs = ['1', 'a', '2', 'b', '3', 'c', '4', 'd']
I'm at a total loss here, any help is appreciated !