X
X
xxx2017-08-13 15:52:06
Django
xxx, 2017-08-13 15:52:06

How to make next element from array in another block?

There is an enumeration by the for loop from the data array.

{% for x in list %}
          <div class="col-md-4">
          {% if x.image %}
            <div class="fh5co-grid animate-box" style="background-image: url({{ x.image.url }});">
              <a class="image-popup text-center" href="{{ x.get_absolute_url }}">
                <div class="work-title">
                  <h3>{{ x.title }}</h3>
                  <span>{{ x.category }}</span>
                </div>
              </a>
            </div>
          {% endif %}
          </div>
{% endfor %}

How to make the third element from the array not be in col-md-4 , but in another one?
And how can you play with elements in other blocks?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexandrBirukov, 2017-08-13
@AlexandrBirukov

https://djbook.ru/rel1.9/ref/templates/builtins.ht... - you can use additional for loop variables - counter, revcounter, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question