alternating table row classes. importing inside the template probably to slow?

This commit is contained in:
phear 2010-04-17 07:51:35 +00:00
parent ee7950ce7a
commit 4be46a339d

View file

@ -35,11 +35,15 @@
<h2>Previous submissions</h2> <h2>Previous submissions</h2>
<table py:if="poll.get_num_of_submissions() > 0"> <table py:if="poll.get_num_of_submissions() > 0">
<tr><th>Submitter</th><th>Content</th><th>Timestamp</th></tr> <tr><th>Submitter</th><th>Content</th><th>Timestamp</th></tr>
<tr py:for="one_submission in poll.get_submissions()"> <?python
<td>${one_submission.submitter}</td> from itertools import cycle
cls=cycle(('rowA','rowB')) ?>
<tr py:for="one_submission in poll.get_submissions()" class="${cls.next()}">
<td>${one_submission.submitter} </td>
<td>${one_submission.get_markup_content()}</td> <td>${one_submission.get_markup_content()}</td>
<td>${one_submission.get_creation_time_string()}</td> <td>${one_submission.get_creation_time_string()}</td>
</tr> </tr>
</table> </table>
<span py:if="poll.get_submissions().count() == 0">No submissions posted</span> <span py:if="poll.get_submissions().count() == 0">No submissions posted</span>
</div> </div>