The dot does not work. As a test I did the following:
-In my template I put {{ param1 }}, param1 is a list of lists.
Result: param1, the lists of lists were printed to the page.
-In my template I put {{ param1.0 }}, expecting to see the first list
in the list of lists.
Result: nothing was printed to the page.
Am I doing something wrong?
On Thu, Sep 2, 2010 at 5:54 PM, Bill Freeman <[email protected]> wrote:
> Don't use [] subscripting, use dot. The template engine tries using
> the thing after the dot in various ways, including as a dictionary key
> and as a list index. So, for example:
>
> {% ifequal param1_trunc.i "-" %}
>
> On Thu, Sep 2, 2010 at 5:11 PM, Bradley Hintze
> <[email protected]> wrote:
>> Hi,
>>
>> Django says that this is a TemplateSyntaxError.
>>
>> if param1_trunc[i][1]
>>
>> The i refers to an index of a for loop as shown:
>>
>> {% for i in pdb1_nums_len_dev6 %}
>> <td>
>> {% ifequal param1_trunc[i] '-' %}
>> {% else %}
>> {% if param1_trunc[i][1] %}
>> {% else %}
>> <center><table><tr><td width=15 height=10 bgcolor=red></table>
>> {% endifequal %}
>> {% endifequal %}
>> {% endfor %}
>>
>> param1_trunc is a list of lists. Can I not access a object within an
>> internal list in a template llke regular python (see below)?
>>
>>>>p =[[1,2,3],[3,4,5]]
>>>>print p[0][1]
>> 2
>>
>>
>>
>>
>> --
>> Bradley J. Hintze
>> Graduate Student
>> Duke University
>> School of Medicine
>> 801-712-8799
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
--
Bradley J. Hintze
Graduate Student
Duke University
School of Medicine
801-712-8799
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.