Wouldn't all this brain-hurting nested loops with inclusion within the view
be infinitely easier if you could just have THE correct structure BEFORE
fiddling with HTML ?
Taken directly from stackoverflow....
def chunks(l, n):
if n < 1:
n = 1
return [l[i:i + n] for i in range(0, len(l), n)]
this turns a list of things into a list of lists AT MOST n long.
right before your
return dict(rows=rows)
place
return dict(way_easier=chunks(rows, 12))
and then
<table>
{{for a_single_line_containing_at_most_12_rows in way_easier:}}
<tr>
{{for a_single_item in a_single_line_containing_at_most_12_rows:}}
<td>{{=a_single_item}}</td>
{{pass}}
</tr>
{{pass}}
</table>
I'll leave the rest as an exercise
What I want is a table with <tr><td> containing a bootstrap grid containing:
>
> <div class="row">
> <div class="col-xs-12 col-sm-6 col-md-3">
> {{include 'default/thumbnail.html'}}
> </div> <!-- /.col-xs-12 col-sm-6 col-md-3 -->
> </div> <!-- /.row -->
>
> rows contains between 60 and 80 records of which I want to display 12 per
> <tr><td>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.