aboutsummaryrefslogtreecommitdiff
path: root/budget/forms.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-08-10 17:06:32 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-08-10 17:07:23 +0200
commit683c7ee0b87bde0866a1f1e815fe50a6a87ed22e (patch)
tree0feeaf738ba69944965093c56276505f5c869636 /budget/forms.py
parent3dd34c6cc48135f59ce4fd397441a11ee09822e6 (diff)
downloadihatemoney-mirror-683c7ee0b87bde0866a1f1e815fe50a6a87ed22e.zip
ihatemoney-mirror-683c7ee0b87bde0866a1f1e815fe50a6a87ed22e.tar.gz
ihatemoney-mirror-683c7ee0b87bde0866a1f1e815fe50a6a87ed22e.tar.bz2
Add tests about project creation and member add.
See #14
Diffstat (limited to 'budget/forms.py')
-rw-r--r--budget/forms.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/budget/forms.py b/budget/forms.py
index 4699531..0c5394b 100644
--- a/budget/forms.py
+++ b/budget/forms.py
@@ -26,6 +26,10 @@ class ProjectForm(Form):
contact_email = TextField("Email", validators=[Required(), Email()])
submit = SubmitField("Create the project")
+ def validate_id(form, field):
+ if Project.query.get(field.data):
+ raise ValidationError("This project id is already used")
+
def save(self):
"""Create a new project with the information given by this form.