chol
/
eva
forked from tohe/eva
1
0
Fork 0
eva/evapp/forms.py

51 lines
1.7 KiB
Python
Raw Normal View History

from django.db import models
from django.forms import ModelForm, DateInput, Form, ChoiceField, RadioSelect
from .models import Employee
2021-01-13 12:12:40 +00:00
# class EmployeeForm(ModelForm):
# class Meta:
# model = Employee
# fields = '__all__'
# widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}),
# 'firstdate_presence': DateInput(attrs={'type': 'date'}),}
2021-01-11 15:12:20 +00:00
class DummyForm(ModelForm):
class Meta:
model = Employee
fields = []
2021-01-13 13:17:21 +00:00
class FdbForm(ModelForm):
'''this base class provides the required css class for all forms'''
required_css_class = 'required'
TYPE_CHOICES = {'IN': 'Eintritt', 'CHANGE': 'Veränderung', 'OUT': 'Austritt'}
2021-01-13 13:17:21 +00:00
class PersonalForm(FdbForm):
choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect,
label='Welcher Prozess soll angestoßen werden?')
2021-01-11 15:12:20 +00:00
class Meta:
model = Employee
2021-01-21 11:55:33 +00:00
fields = ['firstname', 'lastname', 'email', 'department', 'team', ]
2021-01-11 15:12:20 +00:00
2021-01-13 13:17:21 +00:00
class WorkingForm(FdbForm):
2021-01-11 15:12:20 +00:00
class Meta:
model = Employee
2021-01-13 12:12:40 +00:00
fields = ['firstdate_employment', 'firstdate_presence', 'jobdescription_german',
'jobdescription_english', 'desk',]
2021-01-11 15:12:20 +00:00
widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}),
'firstdate_presence': DateInput(attrs={'type': 'date'}),}
2021-01-13 12:12:40 +00:00
2021-01-13 13:17:21 +00:00
class ITForm(FdbForm):
2021-01-13 12:12:40 +00:00
class Meta:
model = Employee
fields = [
'laptop', 'os', 'screen', 'mobile', 'landline', 'comment',
'language', 'accounts', 'lists', ]
2021-01-13 13:17:21 +00:00
class OfficeForm(FdbForm):
2021-01-13 12:12:40 +00:00
class Meta:
model = Employee
fields = ['transponder', 'post_office_box',]