Hi,

It is shown in the documentation that the for loop would only handle a list 
of lists or a list of dictionaries. I'm not sure about a list of tuples. 
Maybe you could consult the source code for more help:

django/template/defaulttags.py

in the definition of:

class ForNode(Node):


------------------------
Xia Kai(夏恺)
[email protected]
http://blog.xiaket.org

--------------------------------------------------
From: "dhruvg" <[email protected]>
Sent: Friday, December 25, 2009 4:00 PM
To: "Django users" <[email protected]>
Subject: Re: templating output for loop incorrect- debugging help

> any thoughts? this issue continues to puzzle me. thanks.
>
> On Dec 24, 4:12 pm, dhruvg <[email protected]> wrote:
>> here is my django code:
>>                         {{ output_integrate.arg_vals }}
>>                         {% for i,o in output_integrate.arg_vals %}
>>                                 <tr>
>>                                         <td align="right">{{ i }}</td>
>>                                         <td align="left"><input 
>> type="text" name="{{ i }}"
>> value="{{ o }}"></td>
>>                                 </tr>
>>                         {% endfor %}
>>
>> the list that is being outputted is [('eggs', ''), ('bacon', ''),
>> ('spam', '')]
>>
>> however, when outputting the tds, nothing is being shown for {{ i }} -
>> it is blank. i would expect {{ i }} to take on the first value in each
>> tuple in the list
>>
>> am i looping through the tuple-list incorrectly?
>>
>> thanks in advance.
> 

--

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.


Reply via email to