Issue
I have a ListView that sends context as news
in the HTML template.
The below code is supposed to slice the context array from the 4th element to until its end
{% for post in news[4:0] %}
............
{% endfor %}
But following error occurs
Could not parse the remainder: '[4:]' from 'news[4:]'
Solution
You can use the slice template tag:
{% for post in news|slice:"4:" %}
............
{% endfor %}
Answered By - zankoAN
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.