-
Notifications
You must be signed in to change notification settings - Fork 2
/
forms.py
64 lines (53 loc) · 2.78 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from flask_wtf import FlaskForm, Form
from flask_wtf.file import FileField, FileAllowed
from wtforms import StringField, PasswordField, SubmitField, IntegerField, BooleanField, FileField, FormField, FieldList
from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError
#TODO: custom drink form, registration form implement, buy credits form implement
#filefield doesn't work
#class uploadMenu(Form):
# name = StringField('Menu Name', validators=[DataRequired(), Length(min=2, max=30)])
# menu = FileField('Menu', validators=[DataRequired(), FileAllowed(['ini'])])
# ingredients = FileField('Ingredients', validators=[DataRequired(), FileAllowed(['ini'])])
# pumps = FileField('Pumps', validators=[DataRequired(), FileAllowed(['ini'])])
# confirm = BooleanField('Confirm Settings')
# submit = SubmitField('Upload')
#custom drink
class ingredientSelect(FlaskForm):
name = IntegerField()
class customDrink(FlaskForm):
#A form for one or more addresses
ingredients = FieldList(FormField(ingredientSelect), min_entries=1)
#custom drink
class uploadMenu(Form):
name = StringField('Menu Name', validators=[DataRequired(), Length(min=2, max=30)])
browse = FileField('Browse File system')
location = StringField('Menu directory location', validators=[DataRequired(), Length(min=2)])
confirm = BooleanField('Confirm Settings')
submit = SubmitField('Upload')
class adminSettings(FlaskForm):
openBar = BooleanField('Open Bar')
custom = BooleanField('Custom Drinks')
adminOveride = BooleanField('Free Drinks for Admin')
confirm = BooleanField('Confirm Settings')
submit = SubmitField('Continue')
class buyDrink(FlaskForm):
ID = StringField('Student ID', validators=[DataRequired(), Length(min=2, max=30)])
confirm = BooleanField('Confirm Order')
submit = SubmitField('Continue')
class confirmOrder(FlaskForm):
confirm = BooleanField('Confirm Order')
submit = SubmitField('Continue')
class adminLogin(FlaskForm):
ID = StringField('Student ID', validators=[DataRequired(), Length(min=2, max=30)])
submit = SubmitField('Login')
class addCredits(FlaskForm):
ID = StringField('Student ID', validators=[DataRequired(), Length(min=2, max=30)])
adminID = StringField('Admin ID', validators=[DataRequired(), Length(min=2, max=30)])
credit = IntegerField('Credit', validators=[DataRequired()])
submit = SubmitField('Add Credits')
class newUser(FlaskForm):
ID = StringField('Student ID', validators=[DataRequired(), Length(min=2, max=30)])
name = StringField('Name', validators=[DataRequired(), Length(min=2, max=30)])
adminID = StringField('Admin ID', validators=[DataRequired(), Length(min=2, max=30)])
credit = IntegerField('Credit', validators=[DataRequired()])
submit = SubmitField('Add Credits')