Is there is some good way to iterate through list in django template and print just items with index which is for example 3,6,9 and so on…
Let’s imagine I have list like this:
({'title':'first'}, {'title':'second'}, {'title':'third'}, .... {'title':'ninth '})
And in template I want to see just:
third
sixth
ninth
I know how to pass variable to template, I construct in a view, but just need the way how to iterate through them in template and print just what I want.
Or I need to construct list (or dictionary maybe) somehow differently? Using latest Django.
Thanks,
Ignas
The
slicefilter will allow you to slice a sequence just as you would in Python.