diff options
Diffstat (limited to 'budget/forms.py')
| -rw-r--r-- | budget/forms.py | 4 |
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. |
