qt - Grantlee Template: Splitting a list into "N" chunks -
using grantlee template system library (so not quite full django template system), i'm trying take list of objects (qlist<qobject *>
), split "n" chunks, , build separate (html) table each chunk.
in template i'm doing like:
{% range objectlist.count startnum %} {% if startnum|divisibleby:16 %} {% include "table.html.django" %} {% endif %} {% endrange %}`
i've tried in table.html.django:
<table> <thead><tr><th>name</th></tr></thead> <tbody> {% range startnum startnum|add:16 num %} <tr><td>{{ num }} {{ objectlist.num.name }}</td></tr> {% endrange %} </tbody> </table>
(range built-in grantlee tag.)
but doesn't reference list item , don't see how access specific item in list when have variable ("num"). there way this?
i tried using slice, looking @ slicefilter::dofilter()
code seems works on lists of strings.
any suggestions on how approach this?
(unfortunately can't create grantlee or grantlee-lib tag post due lack of reputation, maybe can create me?)
Comments
Post a Comment