Hi, 


I have a table, as follows:



class Thing(models.Model):

    name
= models.CharField(maxlength=100)

    color = models.CharField(maxlength=100)

    weight = models.IntegerField()

    [...]



I want to have an HTML table
as follows:



+----------+------------+------------+

| Thing 1  | Thing
2    | Thing 3    |

| white    | green      | black      |

| 23       |
23         | 35         |

[...]



One way I see to do this is:



<tr>

 {%for thing in object_list %}

 <td>{{ thing.name }}</td>

 {% endfor %}

</tr>



etc., but that would mean having about 50 loops in the document
if there are fifty properties for each Thing.



The other way would be to
have a table for every Thing and put all those tables in a row in a master
table. That would be around 30 tables if I have 30 things. Not pretty.



Is there a good way to do this?



Do the 50 for loops actually matter if
I use caching?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

  • [no subject] database . 36852739

Reply via email to