From da8c744227fc2c51bb1668536d9af6987001e345 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 10 Nov 2021 14:29:42 +0100 Subject: [PATCH] offboardng process function reached --- evapp/migrations/0004_auto_20211110_1225.py | 23 +++++++++++++++++++++ evapp/models.py | 2 ++ evapp/urls.py | 6 +++--- evapp/views.py | 13 ++++++++---- 4 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 evapp/migrations/0004_auto_20211110_1225.py diff --git a/evapp/migrations/0004_auto_20211110_1225.py b/evapp/migrations/0004_auto_20211110_1225.py new file mode 100644 index 0000000..75990c9 --- /dev/null +++ b/evapp/migrations/0004_auto_20211110_1225.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.4 on 2021-11-10 12:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('evapp', '0003_auto_20211110_0832'), + ] + + operations = [ + migrations.AddField( + model_name='employee', + name='lastdate_employment', + field=models.DateField(null=True, verbose_name='Letzter Arbeitstag'), + ), + migrations.AddField( + model_name='employee', + name='lastdate_presence', + field=models.DateField(null=True, verbose_name='Letzter Tag der Anwesenheit in der Geschäftsstelle'), + ), + ] diff --git a/evapp/models.py b/evapp/models.py index ac36557..7589765 100644 --- a/evapp/models.py +++ b/evapp/models.py @@ -55,6 +55,8 @@ class Employee(models.Model): # general work related stuff firstdate_employment = models.DateField(null=True, verbose_name="Erster Arbeitstag") firstdate_presence = models.DateField(null=True, verbose_name="Erster Tag der Anwesenheit in der Geschäftsstelle") + lastdate_employment= models.DateField(null=True, verbose_name="Letzter Arbeitstag") + lastdate_presence = models.DateField(null=True, verbose_name="Letzter Tag der Anwesenheit in der Geschäftsstelle") jobdescription_german = models.CharField(null=True, max_length=100, verbose_name="Stellenbezeichnung(deutsch)") jobdescription_english = models.CharField(null=True, max_length=100, verbose_name="Job description(english)") works_in_gs = models.BooleanField(verbose_name='Braucht Arbeitsplatz in der Geschäftsstelle?', default=True) diff --git a/evapp/urls.py b/evapp/urls.py index 7d0a9d1..1332560 100644 --- a/evapp/urls.py +++ b/evapp/urls.py @@ -1,13 +1,13 @@ from django.urls import path -from .views import EvaFormView, success, long_process, change_process +from .views import EvaFormView, success, long_process, change_process, offboarding_process urlpatterns = [ path('', EvaFormView.as_view(condition_dict = {'1': long_process, '2': long_process, '3': long_process, - - '4': change_process,}), + + '4': offboarding_process,}), name='evaform'), path('success', success, name='success') ] diff --git a/evapp/views.py b/evapp/views.py index 6002514..bdc0feb 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -14,7 +14,7 @@ from django.contrib.auth.mixins import LoginRequiredMixin from .models import Employee, DEPARTMENT_CHOICES, OS_CHOICES, VENDOR_CHOICES, \ LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES, KEYBOARD_CHOICES from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm,\ - ChangeForm, TYPE_CHOICES + ChangeForm, TYPE_CHOICES, OffboardingForm from .settings import MAILS, EVA_MAIL, BASIC_DATA, ONLY_ONBOARDING def success(request): @@ -31,13 +31,18 @@ def long_process(wizard): print(data) if data.get('choice') != 'CHANGE': wizard.set_choice('IN') - print('PROZESS IN') + #print('PROZESS IN') return True else: wizard.set_choice('CHANGE') - print('PROZESS NOT IN') + #print('PROZESS NOT IN') return False +def offboarding_process(wizard): + ''' this method is called via urls.py to determine if the form is part of the change process''' + print('OFFBOARDING PROZESS') + return not long_process(wizard) + def change_process(wizard): ''' this method is called via urls.py to determine if the form is part of the change process''' print('CHANGE PROZESS') @@ -46,7 +51,7 @@ def change_process(wizard): class EvaFormView(LoginRequiredMixin, CookieWizardView): template_name = 'evapp/employee_form.html' - form_list = [PersonalForm, WorkingForm, ITForm, OfficeForm, ChangeForm, DummyForm] + form_list = [PersonalForm, WorkingForm, ITForm, OfficeForm, OffboardingForm, DummyForm] instance = None choice = 'IN'