aboutsummaryrefslogtreecommitdiff
path: root/budget/forms.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-07-23 19:11:24 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-07-23 19:11:24 +0200
commitf09d86a06c9e574679ba32ed27da362ede7cd4f1 (patch)
tree459266b261d492b6962b35af482e747e8084998e /budget/forms.py
parentadabd8beec099ffb088bc1b789d7faf08b632ca4 (diff)
downloadihatemoney-mirror-f09d86a06c9e574679ba32ed27da362ede7cd4f1.zip
ihatemoney-mirror-f09d86a06c9e574679ba32ed27da362ede7cd4f1.tar.gz
ihatemoney-mirror-f09d86a06c9e574679ba32ed27da362ede7cd4f1.tar.bz2
Project creation.
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()])