-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
62 lines (53 loc) · 3 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
from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, FloatField, IntegerField, BooleanField, RadioField, SelectField, FileField, PasswordField
from wtforms.validators import InputRequired, Length, Email
from flask_wtf.file import FileField, FileAllowed, FileRequired
class AdminForm(FlaskForm):
"""Form for adding playlists."""
username = StringField("Username", validators=[InputRequired()])
password = PasswordField("Password", validators=[InputRequired()])
class ProductForm(FlaskForm):
image = FileField('image 1', validators=[FileRequired(),
FileAllowed(['jpg','png'],'Images only')])
image1 = FileField('image 2',validators=[
FileAllowed(['jpg','png'],'Images only')],)
image2 = FileField('image 3',validators=[
FileAllowed(['jpg','png'],'Images only')],)
image3 = FileField('image 4',validators=[
FileAllowed(['jpg','png'],'Images only')],)
price = IntegerField('price', validators=[InputRequired()])
title = StringField('title', validators=[InputRequired(), Length(max=20)])
description = StringField('description', validators=[InputRequired()])
category = SelectField('Category', choices=[('bowl','bowl'),('plate','plate'),
('box','box'),('miscellaneous','miscellaneous'),('tray','tray'),
('sign','sign'),('basket','basket'),
('furniture','furniture')])
available = BooleanField('available')
class PurchaseForm(FlaskForm):
firstname = StringField('First name', validators=[InputRequired()])
lastname = StringField('Last name', validators=[InputRequired()])
email = StringField('Email', validators=[InputRequired(),Email(message='Please provide a valid email')])
message = TextAreaField('Message', validators=[Length(max=200)])
class EditForm(FlaskForm):
changeimage = BooleanField('Change Main Image')
image = FileField('image 1', validators=[
FileAllowed(['jpg','png'],'Images only')], render_kw={'disabled':''} )
changeimage1 = BooleanField('Change Second Image')
image1 = FileField('image 2', validators=[
FileAllowed(['jpg','png'],'Images only')],render_kw={'disabled':''})
changeimage2 = BooleanField('Change Third Image')
image2 = FileField('image 3', validators=[
FileAllowed(['jpg','png'],'Images only')],render_kw={'disabled':''})
changeimage3 = BooleanField('Change Fourth Image')
image3 = FileField('image 4', validators=[
FileAllowed(['jpg','png'],'Images only')],render_kw={'disabled':''})
price = IntegerField('price', validators=[InputRequired()])
title = StringField('title', validators=[InputRequired(), Length(max=13)])
description = StringField('description', validators=[InputRequired()])
category = SelectField('Category', choices=[('bowl','bowl'),('plate','plate'),
('box','box'),('miscellaneous','miscellaneous'),('tray','tray'),
('sign','sign'),('basket','basket'),
('furniture','furniture')])
available = BooleanField('available')
class ApiAuth(FlaskForm):
code = IntegerField('Code', validators=[InputRequired()])