aboutsummaryrefslogtreecommitdiff
path: root/budget/forms.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-07-30 15:46:53 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-07-30 15:47:26 +0200
commit87ea04505924a0869e3c806cdf4de3defc1c034c (patch)
tree3f3cdcc482a8b8016518e9134a5cba6b6f89efa1 /budget/forms.py
parent93818d9aba9505c30daf61f42fd9824017a33fe8 (diff)
downloadihatemoney-mirror-87ea04505924a0869e3c806cdf4de3defc1c034c.zip
ihatemoney-mirror-87ea04505924a0869e3c806cdf4de3defc1c034c.tar.gz
ihatemoney-mirror-87ea04505924a0869e3c806cdf4de3defc1c034c.tar.bz2
Invite people after project creation.
Uses the flask-mail extension.
Diffstat (limited to 'budget/forms.py')
-rw-r--r--budget/forms.py10
1 files changed, 10 insertions, 0 deletions
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)