Counter0 only exists for variables declared within template itself for for loops. Lista isn't for loop variable and thus it's always empty.
pe 4. lokak. 2019 klo 17.53 Luca Bertolotti <[email protected]> kirjoitti: > from the view i give to the template the following variables > > selezione = Dbasedett.objects.filter(idbase=mod_id, revdbase=rev_test) > lista = ['test', 'test_one'] > > Than i return render(.........{'selezione':selezione, 'lista':lista} > > In the form i need to do this: > > <table> > > {% for dati in selezione %} > <tr class={% cycle 'odd' 'even' %}> > <td>{{ dati.pos }}</td> <td>{{ dati.matr }}</td> <td>{{ > lista.forloop.counter0 > }}</td> > </tr> > {% endfor %} > > But {{ lista.forloop.counter0 }} is empty > > Any help > > thanks > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/ebb1381a-02a7-46b9-b9c1-0d064596bed7%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/ebb1381a-02a7-46b9-b9c1-0d064596bed7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHn91oe8Mq5WCtuqouqo0Rnhr-VqHg_L37a%2Bi2vDO6Dfp5gF-Q%40mail.gmail.com.

