Quantcast
Channel: for loop with an integer in django's templates tags - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by Joseph Rajchwald for for loop with an integer in django's templates...

You can pass the range from the view to the template and then loop through that. Referencing this SO answer:View:render_to_response('template.html', {..., 'stars': range(review.stars), ...},...

View Article


for loop with an integer in django's templates tags

In my Django template {{review.stars}} is an integer from 1 to 5, but instead of showing a simple number I want to show a number of star icons equal to the {{review.stars}} integer.I should write...

View Article
Browsing latest articles
Browse All 2 View Live