I have invite form with two fields defined as person and email as follows:
class InviteForm(Form):
person = TextField("person", validators=[validators.Required("Please enter persons name.")])
email = EmailField("email", validators=[validators.Required("Please enter valid email."), validators.Email("Please enter valid email.")])
def validate(self):
return validate_form(self)
Where validate_form function is a cusotm validator which check few conditions for invite.
My requirement is to allow users to invite more than one person at a time. To achieve this I have added jquery function which replicates these fields in html form and allow to invite multiple people.
But the problem is in my view function when I extract results from post request it gives only first persons information. How can I get all the persons details. My view is defined as follows:
@app.route("/invite", methods=["GET", "POST"])
def invite():
invite_form = InviteForm()
if invite_form.validate_on_submit():
print invite_form.person
print invite_form.email
This gives only one field, instead of array of fields.
Is this possible with python wtf? How?