I don’t know a lot about Django or Python, but I know it’s problematic using a simple for loop in a template.
I’m wanting to do the following and wondering my options are – is there a simple way to do this in the template?
{% for image in my_images %} //only loop through 1-10
Then:
{% for image in my_images %} //only loop through 10-20
Thanks,
If
my_imagesis a list, you are looking for theslicefilter:Of course, on an optimization note, it would generally be better to do this at a view level by not fetching more records than you need.