-
Notifications
You must be signed in to change notification settings - Fork 3
/
forms.py
154 lines (126 loc) · 5.96 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<<<<<<< HEAD
from wtforms import Form, TextAreaField, BooleanField, StringField, PasswordField, SelectField, DecimalField, IntegerField, FileField, validators
class RegistrationForm(Form):
username = StringField('', [validators.Length(min=4, max=25)],
render_kw={'placeholder': 'Username', 'autofocus': True})
password = PasswordField('', [
validators.DataRequired(),
validators.EqualTo('confirm', message='Passwords must match')],
render_kw={'placeholder': 'Password'}
)
confirm = PasswordField('',
render_kw={'placeholder': 'Repeat Password'}
)
class LoginForm(Form): # Create Login Form
username = StringField('', [validators.length(min=1)],
render_kw={'placeholder': 'Username', 'autofocus': True}
)
password = PasswordField('', [
validators.DataRequired()],
render_kw={'placeholder': 'Password'}
)
class OrderForm(Form): # Create Order Form
name = StringField('', [validators.length(min=1), validators.DataRequired()],
render_kw={'autofocus': True, 'placeholder': 'Full Name'})
mobile_num = StringField('', [validators.length(min=1), validators.DataRequired()],
render_kw={'autofocus': True, 'placeholder': 'Mobile Number'})
quantity = SelectField('', [validators.DataRequired()],
choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5')])
order_place = StringField('', [validators.length(min=1), validators.DataRequired()],
render_kw={'placeholder': 'Delivery Address'})
class AddProduct(Form):
pname = StringField('', [validators.DataRequired()],
render_kw={'autofocus': True})
price = DecimalField('', [validators.DataRequired()])
description = TextAreaField('')
available = IntegerField('', [validators.DataRequired(), validators.NumberRange(min=1, max=50)])
category = SelectField('', [validators.DataRequired()],
choices=[ ('tops','Tops'),
('dress','Dresses'),
('handbags','Handbags'),
('shoes','Shoes'),
('sweaters','Sweaters'),],)
# cb_tshirt_vshape = BooleanField('V-Shape')
# cb_tshirt_polo = BooleanField('Polo')
# cb_tshirt_clean_text = BooleanField('Clean Text')
# cb_tshirt_design = BooleanField('Colorful Design')
# cb_wallet_chain = BooleanField('Chain')
# cb_wallet_leather = BooleanField('Leather')
# cb_wallet_design = BooleanField('Design')
# cb_belt_leather = BooleanField('Leather')
# cb_belt_hook = BooleanField('Hook')
# cb_belt_color = BooleanField('Color')
# cb_belt_design = BooleanField('Design')
# cb_shoes_formal = BooleanField('Formal')
# cb_shoes_converse = BooleanField('Converse')
# cb_shoes_loafer = BooleanField('Loafer')
# cb_shoes_leather = BooleanField('Leather')
# item = StringField('', render_kw={'placeholder': 'Ex: watch/shoes'})
pcode = IntegerField('', [validators.DataRequired()])
# image = FileField('', [validators.DataRequired()])
# def validate_image(form, field):
# if field.data:
=======
from wtforms import Form, TextAreaField, BooleanField, StringField, PasswordField, SelectField, DecimalField, IntegerField, FileField, validators
class RegistrationForm(Form):
username = StringField('', [validators.Length(min=4, max=25)],
render_kw={'placeholder': 'Username', 'autofocus': True})
password = PasswordField('', [
validators.DataRequired(),
validators.EqualTo('confirm', message='Passwords must match')],
render_kw={'placeholder': 'Password'}
)
confirm = PasswordField('',
render_kw={'placeholder': 'Repeat Password'}
)
class LoginForm(Form): # Create Login Form
username = StringField('', [validators.length(min=1)],
render_kw={'placeholder': 'Username', 'autofocus': True}
)
password = PasswordField('', [
validators.DataRequired()],
render_kw={'placeholder': 'Password'}
)
class OrderForm(Form): # Create Order Form
name = StringField('', [validators.length(min=1), validators.DataRequired()],
render_kw={'autofocus': True, 'placeholder': 'Full Name'})
mobile_num = StringField('', [validators.length(min=1), validators.DataRequired()],
render_kw={'autofocus': True, 'placeholder': 'Mobile Number'})
quantity = SelectField('', [validators.DataRequired()],
choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5')])
order_place = StringField('', [validators.length(min=1), validators.DataRequired()],
render_kw={'placeholder': 'Delivery Address'})
class AddProduct(Form):
pname = StringField('', [validators.DataRequired()],
render_kw={'autofocus': True})
price = DecimalField('', [validators.DataRequired()])
description = TextAreaField('')
available = IntegerField('', [validators.DataRequired(), validators.NumberRange(min=1, max=50)])
category = SelectField('', [validators.DataRequired()],
choices=[ ('tops','Tops'),
('dress','Dresses'),
('handbags','Handbags'),
('shoes','Shoes'),
('sweaters','Sweaters'),],)
# cb_tshirt_vshape = BooleanField('V-Shape')
# cb_tshirt_polo = BooleanField('Polo')
# cb_tshirt_clean_text = BooleanField('Clean Text')
# cb_tshirt_design = BooleanField('Colorful Design')
# cb_wallet_chain = BooleanField('Chain')
# cb_wallet_leather = BooleanField('Leather')
# cb_wallet_design = BooleanField('Design')
# cb_belt_leather = BooleanField('Leather')
# cb_belt_hook = BooleanField('Hook')
# cb_belt_color = BooleanField('Color')
# cb_belt_design = BooleanField('Design')
# cb_shoes_formal = BooleanField('Formal')
# cb_shoes_converse = BooleanField('Converse')
# cb_shoes_loafer = BooleanField('Loafer')
# cb_shoes_leather = BooleanField('Leather')
# item = StringField('', render_kw={'placeholder': 'Ex: watch/shoes'})
pcode = IntegerField('', [validators.DataRequired()])
# image = FileField('', [validators.DataRequired()])
# def validate_image(form, field):
# if field.data:
>>>>>>> main
# field.data = re.sub(r'[^a-z0-9_.-]', '_', field.data)