Reputation: 25
I have a Integer value inside {{ review.rating }} . Now I want to loop using jinja , the number of times the value of review.rating.
Eg. if I have review.rating = 4 , I want to display <div>A</div>
, 4 times.
How can I do so?
Upvotes: 0
Views: 143
Reputation: 640
You can use for loop in jinja like this:
{% for i in range(review.rating) %}
<span>{{ i }}</span>
{% endfor %}
Upvotes: 4