I need to render block of html code 5 times in template file. Like in php I tried something like below,
{% extends 'stories/base.html' %}
{% block body %}
<h1>This is rating page</h1>
<section class='rating-widget'>
{% with count = 0 %}
{% while count < 5: %}
<div class='rating-stars text-center'>
<ul class='stars'>
<li class='star selected' title='Poor' data-value='1'>
<i class='fa fa-star fa-fw'></i>
</li>
<li class='star selected' title='Fair' data-value='2'>
<i class='fa fa-star fa-fw'></i>
</li>
<li class='star selected' title='Good' data-value='3'>
<i class='fa fa-star fa-fw'></i>
</li>
<li class='star selected' title='Excellent' data-value='4'>
<i class='fa fa-star fa-fw'></i>
</li>
<li class='star selected' title='WOW!!!' data-value='5'>
<i class='fa fa-star fa-fw'></i>
</li>
</ul>
</div>
{% count += 1 %}
{% endwhile %}
{% endwith %}
</section>
But I couldn't get expected result. It gives me syntax error "'with' expected at least one variable assignment". Is this possible or what is the proper way to implement this kind of loop in django?