M
M
maestro072017-04-12 21:27:46
Django
maestro07, 2017-04-12 21:27:46

How to make numbering in template in table?

<div class="div_table">
              <table>
                <tbody>
                  {% for getLecture in getLectures%}
                    <tr>
                      <td>1</td>
                      <td>
                        <a href="{{ getLecture.pdf.url }}" target="_blank"> {{ getLecture.title }} </a>
                      </td>
                      <td>
                        <a href="{% url 'main:problemlist' %}">Задачи по лекции</a>
                      </td>
                    </tr>										
                  {% endfor %}
                </tbody>
              </table>	
            </div>

69694057751f495d854e62f1c257e0d3.png
displays all the time 1. how to make it output 1, 2, 3 ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2017-04-12
@maestro07

https://docs.djangoproject.com/en/1.11/ref/templat...
<td>{{ forloop.counter }}</td>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question