-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
56 lines (38 loc) · 1.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
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, TextAreaField, IntegerField
from wtforms.fields.core import SelectField
from wtforms.validators import DataRequired, Length
class UserAddForm(FlaskForm):
"""Sign up form."""
username = StringField("Username", validators=[DataRequired()])
password = PasswordField("Password", validators=[Length(min=6)])
image_url = StringField("(Optional) Image URL")
weight = IntegerField("Weight", validators=[DataRequired()])
height = StringField(
"Height (feet'inches e.g. 5'4; or inches e.g 64)", validators=[DataRequired()]
)
gender = SelectField("Gender", validators=[DataRequired()])
age = IntegerField("Age", validators=[DataRequired()])
activity_level = SelectField("Activity Level", validators=[DataRequired()])
diet_plan = SelectField("Diet Plan")
class UserEditForm(FlaskForm):
"""Edit user form."""
username = StringField("Username", validators=[DataRequired()])
password = PasswordField("Password", validators=[Length(min=6)])
image_url = StringField("(Optional) Image URL")
height = StringField("(Optional) Height")
plan = SelectField("Diet Plan")
class LoginForm(FlaskForm):
"""Login form."""
username = StringField("Username", validators=[DataRequired()])
password = PasswordField("Password", validators=[Length(min=6)])
class BMIForm(FlaskForm):
"""BMI form."""
height = StringField("Height (feet'inches e.g. 5'4)", validators=[DataRequired()])
weight = IntegerField("Weight (lbs)", validators=[DataRequired()])
class PlanForm(FlaskForm):
"""Diet Plan form."""
plan = SelectField("Diet Plan")
class FoodIntakeForm(FlaskForm):
"""Food Intake form."""
search = StringField("Search", validators=[DataRequired()])