flask-contacts/forms.py

11 lines
671 B
Python
Raw Normal View History

2017-05-10 18:41:02 +02:00
from flask_wtf import FlaskForm
from wtforms import StringField
from wtforms.validators import DataRequired, Email, Length
class ContactForm(FlaskForm):
name = StringField('Name', validators=[DataRequired(), Length(min=-1, max=80, message='You cannot have more than 80 characters')])
surname = StringField('Surname', validators=[Length(min=-1, max=100, message='You cannot have more than 100 characters')])
email = StringField('E-Mail', validators=[Email(), Length(min=-1, max=200, message='You cannot have more than 200 characters')])
phone = StringField('Phone', validators=[Length(min=-1, max=20, message='You cannot have more than 20 characters')])