-1

I have such object:

data[ 'aaa' ] = ['1', 'something1']
data[ 'bbb' ] = ['2', 'something2']

And want to display it (using loop ) in template :

{% for row in data %}
    <span>{{ row }}</span>>

    {% for d in data.row %}
        {{ d.0 }} || {{ d.1 }}
    {% endfor %}
{% endfor %}

But i see only values within the span tag ( even though array is not empty ) Can you tell me what I am doing wrong ?

Thanks in advance,

pritus
  • 1
  • 4
  • solve it thanks to https://stackoverflow.com/questions/1275735/how-to-access-dictionary-element-in-django-template – pritus Dec 17 '17 at 02:03

1 Answers1

1

The way you're trying to iterate over each row doesn't make sense - either you iterate, or you fetch by index, but doing both will not work. Try this instead:

{% for row in data %}
    {{ d.0 }} || {{ d.1 }}
{% endfor %}
solarissmoke
  • 30,039
  • 14
  • 71
  • 73