Hi Karen:
Thank you for your response. The reason that I care about about column order is so that I can use the same template for different queries with arbitrary column orders using a single variable. I would like to be able to extract the field key name and use them directly in the column header. Perhaps something like this:
01 {% extends "base.html" %}
02
03 {% block head %}{{title}}{% endblock %}
04
05 {% block content %}
06 {% if rows %}
07 <table class="cls1 cls2">
08 {% for row in rows %}
09 {% if forloop.first %}
10
11 <tr class="cls3">
12 <!-- The headers -->
13 {% for key,val in row %}
14 <th class="cls4">key</th>
15 {% endfor %}
16 </tr>
17
18 {% cycle even odd as rc %}
19 <tr class="cls5 {{rc}}">
20 {% for key,val in row %}
21 <td class="cls6">val<td>
22 {% endfor %}
23 </tr>
24 {% endfor %}
25 {% endfor %}
26 </table>
27 { %endif }
28 {% endblock %}
Instead, what I am doing now is I am manually adding the column titles as a separate template variable.
Regards,
Joe
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/BisAYVarqJ4J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment