aboutsummaryrefslogtreecommitdiff
path: root/budget/forms.py
diff options
context:
space:
mode:
author0livd <0livd@users.noreply.github.com>2017-03-12 23:13:52 +0100
committer0livd <0livd@users.noreply.github.com>2017-03-17 19:37:57 +0100
commit59a050e020136e28259e02107edf1025b7a85f1a (patch)
tree6a3166c00aed89ef1978674e0b259ec8075178cc /budget/forms.py
parent10a16a3b5cf13ca6ca2a1f060901b2bc943098ca (diff)
downloadihatemoney-mirror-59a050e020136e28259e02107edf1025b7a85f1a.zip
ihatemoney-mirror-59a050e020136e28259e02107edf1025b7a85f1a.tar.gz
ihatemoney-mirror-59a050e020136e28259e02107edf1025b7a85f1a.tar.bz2
Make ihatemoney Py2/3 compatible
Flask-wtf>=0.13 is now required and Form is replaced by FlaskForm Py2/3 compatibility is assured by six
Diffstat (limited to 'budget/forms.py')
-rw-r--r--budget/forms.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/budget/forms.py b/budget/forms.py
index a097abe..7cdb36d 100644
--- a/budget/forms.py
+++ b/budget/forms.py
@@ -1,6 +1,8 @@
-from flask_wtf import DateField, DecimalField, Email, Form, PasswordField, \
- Required, SelectField, SelectMultipleField, SubmitField, TextAreaField, \
- TextField, ValidationError
+from flask_wtf.form import FlaskForm
+from wtforms.fields.core import SelectField, SelectMultipleField
+from wtforms.fields.html5 import DateField, DecimalField
+from wtforms.fields.simple import PasswordField, SubmitField, TextAreaField, TextField
+from wtforms.validators import Email, Required, ValidationError
from flask_babel import lazy_gettext as _
from flask import request
@@ -35,7 +37,7 @@ class CommaDecimalField(DecimalField):
return super(CommaDecimalField, self).process_formdata(value)
-class EditProjectForm(Form):
+class EditProjectForm(FlaskForm):
name = TextField(_("Project name"), validators=[Required()])
password = TextField(_("Private code"), validators=[Required()])
contact_email = TextField(_("Email"), validators=[Required(), Email()])
@@ -75,13 +77,13 @@ class ProjectForm(EditProjectForm):
"that you will be able to remember.")))
-class AuthenticationForm(Form):
+class AuthenticationForm(FlaskForm):
id = TextField(_("Project identifier"), validators=[Required()])
password = PasswordField(_("Private code"), validators=[Required()])
submit = SubmitField(_("Get in"))
-class PasswordReminder(Form):
+class PasswordReminder(FlaskForm):
id = TextField(_("Project identifier"), validators=[Required()])
submit = SubmitField(_("Send me the code by email"))
@@ -90,7 +92,7 @@ class PasswordReminder(Form):
raise ValidationError(_("This project does not exists"))
-class BillForm(Form):
+class BillForm(FlaskForm):
date = DateField(_("Date"), validators=[Required()], default=datetime.now)
what = TextField(_("What?"), validators=[Required()])
payer = SelectField(_("Payer"), validators=[Required()], coerce=int)
@@ -125,7 +127,7 @@ class BillForm(Form):
raise ValidationError(_("Bills can't be null"))
-class MemberForm(Form):
+class MemberForm(FlaskForm):
name = TextField(_("Name"), validators=[Required()])
weight = CommaDecimalField(_("Weight"), default=1)
@@ -158,7 +160,7 @@ class MemberForm(Form):
self.weight.data = member.weight
-class InviteForm(Form):
+class InviteForm(FlaskForm):
emails = TextAreaField(_("People to notify"))
submit = SubmitField(_("Send invites"))
@@ -170,13 +172,13 @@ class InviteForm(Form):
email=email))
-class CreateArchiveForm(Form):
+class CreateArchiveForm(FlaskForm):
name = TextField(_("Name for this archive (optional)"), validators=[])
start_date = DateField(_("Start date"), validators=[Required()])
end_date = DateField(_("End date"), validators=[Required()], default=datetime.now)
-class ExportForm(Form):
+class ExportForm(FlaskForm):
export_type = SelectField(_("What do you want to download ?"),
validators=[Required()],
coerce=str,