I need to have numbering for table so i am using forloop.counter but i have a problem. i am having a for loop with if condition where there is transaction id as follows:
{% for order in order_list %}
{% if order.transaction_id %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{{order.id}}</td>
<td>{{order.transaction_id}}</td>
<td>{{order.customer}}</td>
<td>{{order.date_ordered}}</td>
<td><a href="{% url 'detailed-transactions' order.id %}">{{ order.transaction_id }}</a></td>
</tr>
{% endif %}
{% endfor %}
since i am checking for transaction id then some records will not be present but the loop will keep going so i will get numbers like 2,5,6 instead of records 1,2,3
first column from left is the numbers which should be 1,2 instaed of 2,5 but it is 2,5 because records 2,5 have the transaction id. I need to put in first column the number of records 1,2 instead of where the records are just like it says 2,5.
Thanks.