Fixed deprecation warning for Form

This commit is contained in:
Joachim Lusiardi 2016-11-06 18:53:13 +01:00
parent 6e665b9f2f
commit 5859763a14
5 changed files with 19 additions and 19 deletions

View File

@ -1,24 +1,24 @@
from flask_wtf import Form from flask_wtf import FlaskForm
from wtforms import SelectField, StringField, SubmitField from wtforms import SelectField, StringField, SubmitField
from wtforms.validators import Length from wtforms.validators import Length
class SelectConsumableForm(Form): class SelectConsumableForm(FlaskForm):
consumable = SelectField('Consumable', coerce=int) consumable = SelectField('Consumable', coerce=int)
submit = SubmitField(label='Do it!') submit = SubmitField(label='Do it!')
class CreateConsumableForm(Form): class CreateConsumableForm(FlaskForm):
name = StringField('Name', validators=[Length(1, 255)]) name = StringField('Name', validators=[Length(1, 255)])
unit = StringField('Unit', validators=[Length(1, 255)]) unit = StringField('Unit', validators=[Length(1, 255)])
submit = SubmitField(label='Do it!') submit = SubmitField(label='Do it!')
class EditConsumableForm(Form): class EditConsumableForm(FlaskForm):
name = StringField('Name', validators=[Length(1, 255)]) name = StringField('Name', validators=[Length(1, 255)])
unit = StringField('Unit', validators=[Length(1, 255)]) unit = StringField('Unit', validators=[Length(1, 255)])
submit = SubmitField(label='Do it!') submit = SubmitField(label='Do it!')
class DeletConsumableForm(Form): class DeletConsumableForm(FlaskForm):
submit = SubmitField(label='Do it!') submit = SubmitField(label='Do it!')

View File

@ -1,6 +1,6 @@
from flask_wtf import Form from flask_wtf import FlaskForm
from wtforms import SubmitField from wtforms import SubmitField
class DeleteAccountForm(Form): class DeleteAccountForm(FlaskForm):
submit = SubmitField(label='Really delete my account!') submit = SubmitField(label='Really delete my account!')

View File

@ -1,14 +1,14 @@
from flask_wtf import Form from flask_wtf import FlaskForm
from wtforms import DateField, IntegerField, DecimalField, SubmitField from wtforms import DateField, IntegerField, DecimalField, SubmitField
from .checks import * from .checks import *
class DeletePitStopForm(Form): class DeletePitStopForm(FlaskForm):
submit = SubmitField(label='Really delete this pitstop!') submit = SubmitField(label='Really delete this pitstop!')
class EditPitstopForm(Form): class EditPitstopForm(FlaskForm):
date = DateField('Date of Pitstop', validators=[date_check]) date = DateField('Date of Pitstop', validators=[date_check])
odometer = IntegerField('Odometer (km)', validators=[odometer_check]) odometer = IntegerField('Odometer (km)', validators=[odometer_check])
litres = DecimalField('Litres (l)', places=2, validators=[litres_check]) litres = DecimalField('Litres (l)', places=2, validators=[litres_check])
@ -34,7 +34,7 @@ class EditPitstopForm(Form):
self.costs.default = self.costs.data self.costs.default = self.costs.data
class CreatePitstopForm(Form): class CreatePitstopForm(FlaskForm):
date = DateField('Date of Pitstop', validators=[date_check]) date = DateField('Date of Pitstop', validators=[date_check])
odometer = IntegerField('Odometer (km)', validators=[odometer_check]) odometer = IntegerField('Odometer (km)', validators=[odometer_check])
litres = DecimalField('Litres (l)', places=2, validators=[litres_check]) litres = DecimalField('Litres (l)', places=2, validators=[litres_check])

View File

@ -1,11 +1,11 @@
from flask_wtf import Form from flask_wtf import FlaskForm
from wtforms import DateField, IntegerField, DecimalField, SubmitField, TextAreaField from wtforms import DateField, IntegerField, DecimalField, SubmitField, TextAreaField
from wtforms.validators import Length from wtforms.validators import Length
from .checks import * from .checks import *
class CreateServiceForm(Form): class CreateServiceForm(FlaskForm):
date = DateField('Date of Service', validators=[date_check]) date = DateField('Date of Service', validators=[date_check])
odometer = IntegerField('Odometer (km)', validators=[odometer_check]) odometer = IntegerField('Odometer (km)', validators=[odometer_check])
costs = DecimalField('Costs (€, overall)', places=2, validators=[costs_check]) costs = DecimalField('Costs (€, overall)', places=2, validators=[costs_check])
@ -33,11 +33,11 @@ class CreateServiceForm(Form):
self.costs.default = 0 self.costs.default = 0
class DeleteServiceForm(Form): class DeleteServiceForm(FlaskForm):
submit = SubmitField(label='Really delete this service!') submit = SubmitField(label='Really delete this service!')
class EditServiceForm(Form): class EditServiceForm(FlaskForm):
date = DateField('Date of Service', validators=[date_check]) date = DateField('Date of Service', validators=[date_check])
odometer = IntegerField('Odometer (km)', validators=[odometer_check]) odometer = IntegerField('Odometer (km)', validators=[odometer_check])
costs = DecimalField('Costs (€, overall)', places=2, validators=[costs_check]) costs = DecimalField('Costs (€, overall)', places=2, validators=[costs_check])

View File

@ -1,20 +1,20 @@
from flask_wtf import Form from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, SelectField, SelectMultipleField from wtforms import StringField, SubmitField, SelectField, SelectMultipleField
from wtforms.validators import Length from wtforms.validators import Length
class SelectVehicleForm(Form): class SelectVehicleForm(FlaskForm):
vehicle = SelectField('Vehicle', coerce=int) vehicle = SelectField('Vehicle', coerce=int)
submit = SubmitField(label='Do it!') submit = SubmitField(label='Do it!')
class EditVehicleForm(Form): class EditVehicleForm(FlaskForm):
name = StringField('Name', validators=[Length(1, 255)]) name = StringField('Name', validators=[Length(1, 255)])
consumables = SelectMultipleField('Consumables', coerce=int,validators=[]) consumables = SelectMultipleField('Consumables', coerce=int,validators=[])
submit = SubmitField(label='Do it!') submit = SubmitField(label='Do it!')
class DeleteVehicleForm(Form): class DeleteVehicleForm(FlaskForm):
submit = SubmitField(label='Do it!') submit = SubmitField(label='Do it!')