stuck trying a for loop in jinja. I have a list/array called "priceNow" with 4 items "prices" in there. But i can't seem to get it to display in html via Jinja.
1) Here is the code that doesn't work, but if it's like any other for loop(like in c) it should iterate through share
and give the values 0, 1, 2, 3.. right?:
{% for share in sharesOwned %}
<tr>
<td>{{ share.symbol }}</td>
<td>{{ share.name }}</td>
<td>{{ share.quanties }}</td>
<td>{{ priceNow[share] }}</td>
</tr>
{% endfor %}
However, when I do specify which list/array like priceNow[2]
, it displays the prices correctly.
{% for share in sharesOwned %}
<tr>
<td>{{ share.symbol }}</td>
<td>{{ share.name }}</td>
<td>{{ share.quanties }}</td>
<td>{{ priceNow[1] }}</td>
</tr>
{% endfor %}
2) More from a design front, how do i get another column of data appended to the current table? I tried this:
{% for share in sharesOwned %}
<tr>
<td>{{ share.symbol }}</td>
<td>{{ share.name }}</td>
<td>{{ share.quanties }}</td>
</tr>
{% endfor %}
{% for priceNow in seq %}
<td>{{ priceNow }}</td>
{% endfor %}
but it adds another row instead of column.. :( how do i just add it to current price column?