aboutsummaryrefslogtreecommitdiff
path: root/budget/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'budget/forms.py')
-rw-r--r--budget/forms.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/budget/forms.py b/budget/forms.py
index 60d1440..d363ad5 100644
--- a/budget/forms.py
+++ b/budget/forms.py
@@ -1,4 +1,5 @@
from flaskext.wtf import *
+from models import Project
# define forms
class CreationForm(Form):
@@ -8,6 +9,16 @@ class CreationForm(Form):
contact_email = TextField("Email", validators=[Required(), Email()])
submit = SubmitField("Get in")
+ def save(self):
+ """Create a new project with the information given by this form.
+
+ Returns the created instance
+ """
+ project = Project(name=self.name.data, id=self.id.data,
+ password=self.password.data,
+ contact_email=self.contact_email.data)
+ return project
+
class AuthenticationForm(Form):
password = TextField("Password", validators=[Required()])