I have the next big list:
row 1: ['col1','col2','col3', 'col4',..., 'col30']
row 2: ['col1','col2','col3', 'col4',..., 'col30']
row 3: ['col1','col2','col3', 'col4',..., 'col30']
.
.
.
row 4000: ['col1','col2','col3', 'col4',..., 'col30']

the variable name that contains this list is 'lst'
For each one of the 4000 rows, I want to display data in a web page in
the next column order:
  col3 col1 col2 col30 col19 ....
  col3 col1 col2 col30 col19 ....
  col3 col1 col2 col30 col19 ....
    .
    .
    .

I made the next in views.py:
.
.
info_dict = { 'data': lst,
           'poscol': ( 2,0,11,29,18,......)
return render_to_response('pres_marcaciones.html', info_dict)

and in the template I wrote:
.
.
{% for m in data %}
    <tr bgcolor="#F2F6FC">
    {% for p in poscol %}
        <td align="center">{{ m.p }}</td>
    {% endfor %}
    </tr>
{% endfor %}

I don get the result I want, I know m.p is not valid. If I do not use
the second for loop I should do:
{% for m in data %}
    <tr bgcolor="#F2F6FC">
    <td align="center">{{ m.2 }}</td>
    <td align="center">{{ m.0 }}</td>
    <td align="center">{{ m.11 }}</td>
    <td align="center">{{ m.29}}</td>
    <td align="center">{{ m.18}}</td>
    .
    .
    .
    </tr>
{% endfor %}

Which looks repetitive. Is this the only and recommended way to do this
under django or which trick could I use?
Thanks!!


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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