From b02c3820ecad52b6ed812fe17564bb37cec0510e Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 13 Jan 2021 13:12:40 +0100 Subject: [PATCH] added ITForm and OfficeForm --- evapp/forms.py | 27 ++++++++++++++++++++------- evapp/views.py | 4 ++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/evapp/forms.py b/evapp/forms.py index 2d799a2..bf0ffc9 100644 --- a/evapp/forms.py +++ b/evapp/forms.py @@ -3,12 +3,12 @@ from django.forms import ModelForm, DateInput from .models import Employee -class EmployeeForm(ModelForm): - class Meta: - model = Employee - fields = '__all__' - widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}), - 'firstdate_presence': DateInput(attrs={'type': 'date'}),} +# class EmployeeForm(ModelForm): +# class Meta: +# model = Employee +# fields = '__all__' +# widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}), +# 'firstdate_presence': DateInput(attrs={'type': 'date'}),} class PersonalForm(ModelForm): class Meta: @@ -18,6 +18,19 @@ class PersonalForm(ModelForm): class WorkingForm(ModelForm): class Meta: model = Employee - fields = ['firstdate_employment', 'firstdate_presence', 'jobdescription_german', 'jobdescription_english', 'desk',] + fields = ['firstdate_employment', 'firstdate_presence', 'jobdescription_german', + 'jobdescription_english', 'desk',] widgets = {'firstdate_employment': DateInput(attrs={'type': 'date'}), 'firstdate_presence': DateInput(attrs={'type': 'date'}),} + +class ITForm(ModelForm): + class Meta: + model = Employee + fields = [ + 'laptop', 'os', 'screen', 'mobile', 'landline', 'comment', + 'language', 'accounts', 'lists', ] + +class OfficeForm(ModelForm): + class Meta: + model = Employee + fields = ['transponder', 'post_office_box',] diff --git a/evapp/views.py b/evapp/views.py index be6cd46..6ffb465 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -9,7 +9,7 @@ from formtools.wizard.views import CookieWizardView from django.shortcuts import render from .models import Employee -from .forms import EmployeeForm, PersonalForm, WorkingForm +from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm from .settings import MAILS, EVA_MAIL def success(request): @@ -47,7 +47,7 @@ def send_mail_to_department(department, data): class EvaFormView(CookieWizardView): # model = Employee template_name = 'evapp/employee_form.html' - form_list = [PersonalForm, WorkingForm] + form_list = [PersonalForm, WorkingForm, ITForm, OfficeForm,] instance = None # form_class = EmployeeForm