-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
126 lines (126 loc) · 3.29 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
from django import forms
from django.contrib.auth.models import User
from .models import Resume
class DateInput(forms.DateInput):
input_type = 'date'
class ResumeForm(forms.ModelForm):
BLACK = 'Black'
WHITE = 'White'
COLOURED = 'Coloured'
INDIAN = 'Indian'
CHINESE = 'Chinese'
MALE = 'Male'
FEMALE = 'Female'
OTHER = 'Other'
MARRIED = 'Married'
SINGLE = 'Single'
WIDOWED = 'Widowed'
DIVORCED = 'Divorced'
GAUTENG = 'Gauteng'
MPUMALANGA = 'Mpumalanga'
FREE_STATE = 'Free-state'
NORTH_WEST = 'North-west'
LIMPOPO = 'Limpopo'
WESTERN_CAPE = 'Western-cape'
NOTHERN_CAPE = 'Nothern-cape'
EASTERN_CAPE = 'Eastern-cape'
KWAZULU_NATAL = 'Kwazulu-natal'
ETHNIC_CHOICES = [
(BLACK, 'Black'),
(WHITE, 'White'),
(COLOURED, 'Coloured'),
(INDIAN, 'Indian'),
(CHINESE, 'Chinese'),
]
SEX_CHOICES = [
(MALE, 'Male'),
(FEMALE, 'Female'),
(OTHER, 'Other'),
]
MARITAL_CHOICES = [
(MARRIED, 'Married'),
(SINGLE, 'Single'),
(WIDOWED, 'Widowed'),
(DIVORCED, 'Divorced'),
]
PROVINCE_CHOICES = [
(GAUTENG, 'Gauteng'),
(MPUMALANGA, 'Mpumalanga'),
(FREE_STATE, 'Free-state'),
(NORTH_WEST, 'North-west'),
(LIMPOPO, 'Limpopo'),
(WESTERN_CAPE, 'Western-cape'),
(NOTHERN_CAPE, 'Nothern-cape'),
(EASTERN_CAPE, 'Eastern-cape'),
(KWAZULU_NATAL, 'Kwazulu-natal'),
]
image = forms.ImageField(
required=False,
widget=forms.FileInput(attrs={'class': 'form-control'})
)
date_birth = forms.DateField(
required = True,
# input_formats=['%d-%m-%Y'],
widget=DateInput(attrs={'class': 'form-control', 'placeholder': 'Enter a date: '}),
)
ethnicity = forms.ChoiceField(
choices = ETHNIC_CHOICES,
widget=forms.Select(attrs={'class': 'nice-select rounded'}),
)
sex = forms.ChoiceField(
choices = SEX_CHOICES,
widget=forms.Select(attrs={'class': 'nice-select rounded'}),
)
marital_status = forms.ChoiceField(
choices = MARITAL_CHOICES,
widget=forms.Select(attrs={'class': 'nice-select rounded'}),
)
addressLine1 = forms.CharField(
required = True,
widget=forms.TextInput(attrs={'class': 'form-control resume', 'placeholder': 'Enter Address Line 1'}),
)
addressLine2 = forms.CharField(
required=False,
widget=forms.TextInput(attrs={'class': 'form-control resume', 'placeholder': 'Enter Address Line 2'}),
)
suburb = forms.CharField(
required=True,
widget=forms.TextInput(attrs={'class': 'form-control resume', 'placeholder': 'Enter Suburb'}),
)
city = forms.CharField(
required = True,
widget=forms.TextInput(attrs={'class': 'form-control resume', 'placeholder': 'Enter City'}),
)
province = forms.ChoiceField(
choices = PROVINCE_CHOICES,
widget=forms.Select(attrs={'class': 'nice-select rounded'}),
)
phoneNumber = forms.CharField(
required = True,
widget=forms.TextInput(attrs={'class': 'form-control resume', 'placeholder': 'Enter Phone Number'}),
)
cover_letter = forms.FileField(
required=False,
widget=forms.FileInput(attrs={'class': 'form-control'})
)
cv = forms.FileField(
required=False,
widget=forms.FileInput(attrs={'class': 'form-control'})
)
class Meta:
model = Resume
fields = [
'image',
'date_birth',
'ethnicity',
'sex',
'marital_status',
'addressLine1',
'addressLine2',
'suburb',
'city',
'province',
'phoneNumber',
'cover_letter',
'cv',
]