Loops

For working on record sets, you need a construct to loop through lists. Take a look at the inside of the t-call element, where the actual content generation happens. The template expects to be rendered with a context that has a variable called books set and iterates through it in the t-foreach element. Iteration can happen in a t element, in which case its contents are repeated for every member of the iterable that was passed in the t-foreach attribute. You can also place the t-foreach and t-as attributes in some arbitrary element; then, this element and its contents will be repeated for every item in the iterable. The t-as attribute is mandatory and will be used as the name of the iterator variable to use for accessing the iterated data. While the most common use for this construction is to iterate over record sets, you can use it on any Python object that is iterable.