From effa216b2b7005e6d14c69f932b7b696723a666f Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 2 Mar 2021 10:54:35 +0100 Subject: [PATCH] temporary deactivated CHANGE and EXIT --- evapp/forms.py | 7 ++++--- evapp/settings.py | 3 +++ evapp/templates/evapp/employee_form.html | 9 ++++++--- evapp/views.py | 23 ++++++++++++++--------- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/evapp/forms.py b/evapp/forms.py index 266b958..c63b58e 100644 --- a/evapp/forms.py +++ b/evapp/forms.py @@ -23,8 +23,9 @@ class EvaForm(ModelForm): TYPE_CHOICES = {'IN': 'Eintritt', 'CHANGE': 'Veränderung', 'OUT': 'Austritt'} class PersonalForm(EvaForm): - choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect, - label='Welcher Prozess soll angestoßen werden?') + # TODO: comment this back in to use implementation of change or exit process + # choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect, + # label='Welcher Prozess soll angestoßen werden?') class Meta: model = Employee @@ -34,7 +35,7 @@ class WorkingForm(EvaForm): def clean(self): data = self.cleaned_data - if not data['remote'] and data['desk'] is None: + if not data['remote'] and data['desk'] is None: raise ValidationError('Wer nicht remote arbeitet braucht einen Schreibtisch!') return data diff --git a/evapp/settings.py b/evapp/settings.py index 16d800e..ff4ac6a 100644 --- a/evapp/settings.py +++ b/evapp/settings.py @@ -1,3 +1,6 @@ +# temporary setting while change and exit is not yet fully implemented +ONLY_ONBOARDING = True + # sender mail adress EVA_MAIL = 'benni.baermann@wikimedia.de' diff --git a/evapp/templates/evapp/employee_form.html b/evapp/templates/evapp/employee_form.html index fa0c248..bbb5796 100644 --- a/evapp/templates/evapp/employee_form.html +++ b/evapp/templates/evapp/employee_form.html @@ -60,9 +60,12 @@
{% csrf_token %} - {% if wizard.steps.step1 > 1 %} - Du hast den Prozess "{{choice_string}}" ausgewählt. - {% endif %} + {% comment %} + comment this back in if you want to use CHANGE and EXIT process + {% if wizard.steps.step1 > 1 %} + Du hast den Prozess "{{choice_string}}" ausgewählt. + {% endif %} + {% endcomment %} {{ wizard.management_form }} {% if wizard.form.forms %} {{ wizard.form.management_form }} diff --git a/evapp/views.py b/evapp/views.py index 9e26342..1227fc6 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -14,7 +14,7 @@ from .models import Employee, DEPARTMENT_CHOICES, LAPTOP_CHOICES, OS_CHOICES, VE MOBILE_CHOICES, LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm,\ ChangeForm, TYPE_CHOICES -from .settings import MAILS, EVA_MAIL, BASIC_DATA +from .settings import MAILS, EVA_MAIL, BASIC_DATA, ONLY_ONBOARDING def success(request): return HttpResponse("Vielen Dank! Du hast E.V.A. erfolgreich ausgefüllt. Die Mails an die Abteilungen wurden versendet.") @@ -22,16 +22,20 @@ def success(request): def long_process(wizard): '''this method is called via urls.py to determine if a form is part of the IN-Process''' - data = wizard.get_cleaned_data_for_step('0') or {} - print(data) - if data.get('choice') != 'CHANGE': + if ONLY_ONBOARDING: wizard.set_choice('IN') - print('PROZESS IN') return True else: - wizard.set_choice('CHANGE') - print('PROZESS NOT IN') - return False + data = wizard.get_cleaned_data_for_step('0') or {} + print(data) + if data.get('choice') != 'CHANGE': + wizard.set_choice('IN') + print('PROZESS IN') + return True + else: + wizard.set_choice('CHANGE') + print('PROZESS NOT IN') + return False def change_process(wizard): ''' this method is called via urls.py to determine if the form is part of the change process''' @@ -76,6 +80,7 @@ class EvaFormView(CookieWizardView): context.update({'choice': self.choice, 'choice_string': TYPE_CHOICES[self.choice]}) + # deliver context for forms if we are in the last step if (self.steps.step1 == 5 or (self.choice != 'IN' and self.steps.step1 == 3)): context.update({'data': self.beautify_data(self.get_all_cleaned_data()), 'datatable': True,}) @@ -105,7 +110,7 @@ class EvaFormView(CookieWizardView): if not settings.DEBUG: self.instance.delete() - + return HttpResponseRedirect('success')