I am trying to automate the creation of something like this:
<input type='text' name='asdf[]' />
<input type='text' name='asdf[]' />
<input type='text' name='asdf[]' />
By cycling through a range in the form. I've been trying things like this, along with several other variations:
# in a model class
for i in range(1, prim+1):
self.fields['asdf'] = forms.CharField(label=i)
# in the template
<form action='#' method='post'>
{{form.as_p}}
</form>
But I haven't had any luck though.
How can I go about automating an array of inputs?
** edit ** To clarify, eventually I need to be able to access the fields in the template like this:
{% for input in form.fields.asdf %}
{{input}}
{% endfor %}
Which would then hopefully get me the original input list shown above...