From 87ea04505924a0869e3c806cdf4de3defc1c034c Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sat, 30 Jul 2011 15:46:53 +0200 Subject: Invite people after project creation. Uses the flask-mail extension. --- budget/forms.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'budget/forms.py') diff --git a/budget/forms.py b/budget/forms.py index 45da1f3..0d9dae5 100644 --- a/budget/forms.py +++ b/budget/forms.py @@ -47,3 +47,13 @@ class MemberForm(Form): if Person.query.filter(Person.name == field.data)\ .filter(Person.project == form.project).all(): raise ValidationError("This project already have this member") + +class InviteForm(Form): + emails = TextAreaField("People to notify") + submit = SubmitField("Send invites") + + def validate_emails(form, field): + validator = Email() + for email in [email.strip() for email in form.emails.data.split(",")]: + if not validator.regex.match(email): + raise ValidationError("The email %s is not valid" % email) -- cgit v1.1