Hi,
How to generate multiple forms with a loop?
In my controller file there are forms generated with this loop:
thing=[one, two, three]
def theFunction():
for thing1 in varibale1:
form=FORM(':',
INPUT(_name='name')
)
return dict(form=form)
...but this code doesn't work. I just get the message "invalid view".
I suppose the reason that I get this message is that all the forms
have the same name in the view file. Therefor I also tried with:
return dict(form=[thing])
...but got:
SyntaxError: keyword can't be an expression
I've tried with this code in the view file:
{{extend 'layout.html'}}
<h2>{{=form}}</h2>
...and also with this:
{{extend 'layout.html'}}
<h2>
{{thing=[one, two, three]}}
{{for thing1 in varibale1:}}
{{=form}}
</h2>
...but none of them worked.
Thanks in advance for help