-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathforms.py
49 lines (31 loc) · 1.63 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from flask_wtf import FlaskForm
from wtforms import StringField, IntegerField, SubmitField, FloatField, PasswordField
from wtforms.validators import InputRequired, EqualTo
class CreateForm(FlaskForm):
name = StringField('Name of Account: ', [InputRequired()])
balance = FloatField('Opening balance (optional)')
password = PasswordField('Account password', [InputRequired(), EqualTo(
'pwd_confirm', message='Passwords must match')])
pwd_confirm = PasswordField('Confirm account password')
submit = SubmitField('Create Account')
class LoginForm(FlaskForm):
id = IntegerField('Account ID: ', [InputRequired()])
password = PasswordField('Account password: ', [InputRequired()])
submit = SubmitField('Login')
class WithdrawForm(FlaskForm):
amount = FloatField('Withdraw Amount: ', [InputRequired()])
withdraw = SubmitField('Withdraw Amount')
class DepositForm(FlaskForm):
amount = FloatField('Deposit Amount: ', [InputRequired()])
deposit = SubmitField('Deposit Amount')
class TransferForm(FlaskForm):
account_id = IntegerField("Recipient's Account ID: ", [InputRequired()])
amount = FloatField('Transfer Amount: ', [InputRequired()])
password = PasswordField('Account password: ', [InputRequired()])
transfer = SubmitField('Transfer Amount')
class DeleteForm(FlaskForm):
id = IntegerField('Account ID to Delete: ', [InputRequired()])
password = PasswordField('Account password: ', [InputRequired(), EqualTo(
'pwd_confirm', message='Passwords must match')])
pwd_confirm = PasswordField('Confirm account password: ')
submit = SubmitField('Delete Account')