I have the following section in my template where I make use of indexing my query set to access its fields. I know this can be done without indexing but I am trying whether this can be done by indexing. confirmed_length
is a list which is [0]
and confirmed_bookings
is the query_set
{% for i in confirmed_length %}
<tr>
<th scope="row">{{ confirmed_bookings.0.booking_id }}</th>
<td>{{ i }}</td>
<td>{{ confirmed_bookings.0.booking_date }}</td>
<td>{{ confirmed_bookings.i.room_id }}</td>
</tr>
{% endfor %}
where {{ i }}
shows 0 but nothing shows for others except
{{ confirmed_bookings.0.booking_date }}
and {{ confirmed_bookings.0.booking_id }}
. Indexing with 0
shows me the details but indexing with i
(where i
is an integer and its value is 0) does not show anything.