I think you can make comparisons, but try to limit the amount of logic that
you implement in your templates.

On Fri, Feb 13, 2015 at 6:14 PM, dk <demi...@gmail.com> wrote:

> I am assuming in django  doing i.1  or i.2  will be the same as  i[1],
> i[2] right?
>
> can I do if statements too?  like if i.2 == to somestuff? do something? or
> all that need to be set in the view function?
>
> thanks
>
>
> On Thursday, February 12, 2015 at 12:15:50 PM UTC-6, Vijay Khemlani wrote:
>
>> If you have a fixed number of items in each of the sublists you can do
>>
>> {{ i.0 }}   # First element
>> {{ i.1 }}   # Second element
>>
>> or you can iterate over it
>>
>> {% for sub_element in i %}
>>     {{ sub_element }}
>> {% endfor %}
>>
>> On Thu, Feb 12, 2015 at 2:55 PM, dk <dem...@gmail.com> wrote:
>>
>>> i do have a list  of list like this
>>> [  [apple, banana, red] ,  [orange, grape, blue] ,  [watermelon,
>>> tangerine, purple]       ]
>>>
>>>
>>> then i am passing it to the template like
>>> return render(request, "show_table.html", {"lista": lista})
>>> inside my template html i have
>>>
>>>
>>>     <table border="1" style="width: 100%">
>>>     {% for i in lista %}
>>>         <tr>
>>>             <td>{{ i }}</td>
>>> {#            <td> ----> Temp  </td>#}
>>> {#            <td> {{ i }}</td>#}
>>>         </tr>
>>>
>>>     {% endfor %}
>>>     </table>
>>>
>>>
>>>
>>> but how can i select i[0]   or i[2] to put then into a diferent
>>> column?    might be a better trick on how to send it?
>>> 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 django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/ec4f230b-73f0-495c-ad2d-db921ed227cc%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/ec4f230b-73f0-495c-ad2d-db921ed227cc%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/63004a1d-6aad-481b-9563-26182bbd9f39%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/63004a1d-6aad-481b-9563-26182bbd9f39%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei1RFeV9B0Qfpwcx5PYZ%3DYU55Vk6yYU4Gnqbrx1dd1wBHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to