Zope ZPT Display a query resultset dynamically

This basic markup will display any resultset with field names in the table head and corresponding data in the table body.
<table tal:define="results here/my_zsql_method">
<thead>
<tr>
	<th tal:repeat="name results/names" tal:content="name" />
</tr>	
</thead>
<tbody>
<tr tal:repeat="row results">
	<td tal:repeat="name results/names" tal:content="python: row[name]" />
</tr>
</tbody>
</table>
Posted by
Snippet Viewed 1356 times.

Share your Zope ZPT code snippets:

  • Get some recognition & link back to your site.

 

Submit | Browse

Most Recent zope zpt snippets

Most Viewed