I have an integer value being passed to my template, and I want to create a number of html elements equal to that integer.
game.players is a number 0-10.
I want to create a number of input elements equal to the count of game.players.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Either populate the context with an iterable or define a template filter that handles a number input and outputs an iterable.
Note: it’s recommended to define the iterable in your view as that’s the django philosophy and why there’s no built in range filter.
Here’s what a core dev thinks: