-
Notifications
You must be signed in to change notification settings - Fork 40
/
forms.py
104 lines (90 loc) · 4.13 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
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.fields.core import SelectField
from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError
from apps import App
class RegistrationForm(FlaskForm):
username = StringField('Username',
validators=[DataRequired(), Length(min=2, max=20)])
email = StringField('Email',
validators=[DataRequired(), Email()])
password = PasswordField('Password', validators=[DataRequired()])
confirm_password = PasswordField(
'Confirm Password', validators=[
DataRequired(), EqualTo('password')])
submit = SubmitField('Sign Up')
def validate_email(self, email):
app_object = App()
mongo = app_object.mongo
temp = mongo.db.ath.find_one({'email': email.data}, {'email', 'pwd'})
if temp:
raise ValidationError('Email already exists!')
class LoginForm(FlaskForm):
email = StringField('Email',
validators=[DataRequired(), Email()])
password = PasswordField('Password', validators=[DataRequired()])
remember = BooleanField('Remember Me')
type = SelectField(
'Login Type', choices=[
('Manager', "Manager"), ("Applicant", "Applicant")])
submit = SubmitField('Login')
class PostingForm(FlaskForm):
"""name = StringField('Your Name: ',
validators=[DataRequired(), Length(min=2, max=20)])
"""
designation = StringField(
'Job Designation: ', validators=[
DataRequired(), Length(
min=2, max=20)])
job_title = StringField('Job Title: ',
validators=[DataRequired()])
job_location = StringField('Job Location: ',
validators=[DataRequired()])
job_description = StringField('Job Description: ',
validators=[DataRequired()])
skills = StringField('Skills Required: ',
validators=[DataRequired()])
schedule = StringField('Schedule of the job (in hours): ',
validators=[DataRequired()])
salary = StringField('Salary: ',
validators=[DataRequired(), Length(min=2, max=20)])
rewards = StringField('Rewards / Benefits: ',
validators=[DataRequired(), Length(min=2, max=50)])
submit = SubmitField('POST')
class ApplyForm(FlaskForm):
apply_name = StringField(
'Name: ', validators=[
DataRequired(), Length(
min=2, max=20)])
apply_phone = StringField(
'Phone Number: ', validators=[
DataRequired(), Length(
min=2, max=20)])
apply_address = StringField('Address: ',
validators=[DataRequired()])
dob = StringField('Date of Birth: ',
validators=[DataRequired(), Length(min=2, max=20)])
"""position = StringField('Job Position applying for: ',
validators=[DataRequired(), Length(min=2, max=100)])
"""
skills = StringField('Your Skills: ',
validators=[DataRequired()])
availability = StringField('Availability (hours per day in a week): ',
validators=[DataRequired()])
"""resume = StringField('Upload Resume: *****',
validators=[DataRequired(), Length(min=2, max=50)])
"""
signature = StringField('Signature (Full Name): ',
validators=[DataRequired(), Length(min=2, max=20)])
schedule = StringField('Schedule: ',
validators=[DataRequired()])
submit = SubmitField('APPLY')
class ForgotPasswordForm(FlaskForm):
email = StringField('Email', validators=[DataRequired(), Email()])
submit = SubmitField('Submit')
class ResetPasswordForm(FlaskForm):
password = PasswordField('Password', validators=[DataRequired()])
confirm_password = PasswordField(
'Confirm Password', validators=[
DataRequired(), EqualTo('password')])
submit = SubmitField('Reset')