Hello I have solved using a tuple because i need to compare value:
{% for matric,lotto,rimanenza in lista_finale %} {% if matric == dati.partn
%}<td>{{ lotto }} -- {{ rimanenza }}</td>{% endif %}{% endfor %}</tr>
Where lista finale is a list of tuple
Thanks to all
Il giorno mercoledì 9 ottobre 2019 19:28:50 UTC+2, Luqman Shofuleji ha
scritto:
>
> Sorry little mistake there:
>
> Then in your template:
> <tr>
> {% for a in mylist %}
> <td>{{ a }}</td>
> {% endfor %}
> </tr>
>
> On Wed, Oct 9, 2019 at 2:27 PM Luqman Shofuleji <[email protected]
> <javascript:>> wrote:
>
>> 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:
>> <tr>
>> {% for a in mylist %}
>> <td>{{ mylist }}</td>
>> {% endfor %}
>> </tr>
>>
>>
>>
>>
>>
>>
>>
>> On Wed, Oct 9, 2019 at 9:17 AM Luca Bertolotti <[email protected]
>> <javascript:>> wrote:
>>
>>> 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:
>>>
>>> <tr>{% for a in n %} <td>{{ mylist.a }}</td></tr>
>>>
>>> it never show nothing, but if i do:
>>>
>>> <tr>{% for a in n %} <td>{{ mylist.0 }}</td></tr>
>>> it show 'aa'
>>>
>>> Where is the mistake?
>>>
>>> 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] <javascript:>.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/af0a2286-6bf9-4b9e-9a77-626ae5309ee6%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/django-users/af0a2286-6bf9-4b9e-9a77-626ae5309ee6%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/fe2c2400-f685-41a4-a81b-bededaec3f30%40googlegroups.com.