Search Results

Search found 1 results on 1 pages for 'lost9123193'.

Page 1/1 | 1 

  • Email Validation from WTForm using Flask

    - by lost9123193
    I'm following a Flask tutorial from http://code.tutsplus.com/tutorials/intro-to-flask-adding-a-contact-page--net-28982 and am currently stuck on the validation step: The old version had the following: from flask.ext.wtf import Form, TextField, TextAreaField, SubmitField, validators, ValidationError class ContactForm(Form): name = TextField("Name", [validators.Required("Please enter your name.")]) email = TextField("Email", [validators.Required("Please enter your email address."), validators.Email("Please enter your email address.")]) submit = SubmitField("Send") Reading the comments I updated it to this: (replaced validators.Required with InputRequired) (same fields) class ContactForm(Form): name = TextField("Name", validators=[InputRequired('Please enter your name.')]) email = EmailField("Email", validators=[InputRequired("Please enter your email address.")]), validators.Email("Please enter your email address.")]) submit = SubmitField("Send") My only issue is I don't know what to do with the validators.Email. The error message I get is: NameError: name 'validators' is not defined I've looked over the documentation, perhaps I didn't delve deep enough but I can't seem to find an example for email validation.

    Read the article

1