Re: list cycle in template

2019-10-09 Thread Luca Bertolotti
Hello I have solved using a tuple because i need to compare value: {% for matric,lotto,rimanenza in lista_finale %} {% if matric == dati.partn %}{{ lotto }} -- {{ rimanenza }}{% endif %}{% endfor %} Where lista finale is a list of tuple Thanks to all Il giorno mercoledì 9 ottobre 2019 19:28:50

Re: list cycle in template

2019-10-09 Thread Luqman Shofuleji
1) you forgot to include {% endfor %} in you template 2) I believe in your view all you actually need is: mylist = ['aa','bb'] return render({'mylist':mylist}) Then in your template: {% for a in mylist %} {{ mylist }}

Re: list cycle in template

2019-10-09 Thread Luqman Shofuleji
Sorry little mistake there: Then in your template: {% for a in mylist %} {{ a }} {% endfor %} On Wed, Oct 9, 2019 at 2:27 PM Luqman Shofuleji wrote: > 1) you forgot to include

Re: list cycle in template

2019-10-09 Thread Cornelis Poppema
{{ mylist.a }} means: get attribute "a" from object "mylist". For the template it doesn't matter if you have defind a variable "a", it will get the literal "a". Also see https://stackoverflow.com/questions/4651172/reference-list-item-by-index-withdoesin-django-template

list cycle in template

2019-10-09 Thread Luca Bertolotti
Hello in the view a hve a list mylist = ['aa','bb'] n = range(len(mylist)) return render({'mylist':mylist,'n':n,.}) in the template i do this: {% for a in n %} {{ mylist.a }} it never show nothing, but if i do: {% for a in n %} {{ mylist.0 }} it show 'aa' Where is the mistake? Thanks