-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.py
More file actions
49 lines (42 loc) · 1.53 KB
/
forms.py
File metadata and controls
49 lines (42 loc) · 1.53 KB
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
from django import forms
from .models import Employee, Leave, Absence, Performance, Reward, Compensation, Payroll
class EmployeeForm(forms.ModelForm):
class Meta:
model = Employee
fields = '__all__'
class LeaveForm(forms.ModelForm):
class Meta:
model = Leave
fields = ['employee', 'start_date', 'end_date', 'reason']
widgets = {
'start_date': forms.DateInput(attrs={'type': 'date'}),
'end_date': forms.DateInput(attrs={'type': 'date'}),
}
class AbsenceForm(forms.ModelForm):
class Meta:
model = Absence
fields = ['employee', 'date', 'reason']
widgets = {
'date': forms.DateInput(attrs={'type': 'date'}),
}
class PerformanceForm(forms.ModelForm):
class Meta:
model = Performance
fields = ['employee', 'rating', 'comments']
class RewardForm(forms.ModelForm):
class Meta:
model = Reward
fields = ['employee', 'name', 'description']
class CompensationForm(forms.ModelForm):
class Meta:
model = Compensation
fields = ['employee', 'salary', 'bonus']
class PayrollForm(forms.ModelForm):
class Meta:
model = Payroll
fields = ['employee', 'pay_period_start', 'pay_period_end', 'payment_date', 'gross_pay', 'deductions']
widgets = {
'pay_period_start': forms.DateInput(attrs={'type': 'date'}),
'pay_period_end': forms.DateInput(attrs={'type': 'date'}),
'payment_date': forms.DateInput(attrs={'type': 'date'}),
}