temporary deactivated CHANGE and EXIT

This commit is contained in:
Benni Bärmann 2021-03-02 10:54:35 +01:00
parent 51b760404a
commit effa216b2b
4 changed files with 27 additions and 15 deletions

View File

@ -23,8 +23,9 @@ class EvaForm(ModelForm):
TYPE_CHOICES = {'IN': 'Eintritt', 'CHANGE': 'Veränderung', 'OUT': 'Austritt'} TYPE_CHOICES = {'IN': 'Eintritt', 'CHANGE': 'Veränderung', 'OUT': 'Austritt'}
class PersonalForm(EvaForm): class PersonalForm(EvaForm):
choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect, # TODO: comment this back in to use implementation of change or exit process
label='Welcher Prozess soll angestoßen werden?') # choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect,
# label='Welcher Prozess soll angestoßen werden?')
class Meta: class Meta:
model = Employee model = Employee

View File

@ -1,3 +1,6 @@
# temporary setting while change and exit is not yet fully implemented
ONLY_ONBOARDING = True
# sender mail adress # sender mail adress
EVA_MAIL = 'benni.baermann@wikimedia.de' EVA_MAIL = 'benni.baermann@wikimedia.de'

View File

@ -60,9 +60,12 @@
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
<table> <table>
{% if wizard.steps.step1 > 1 %} {% comment %}
Du hast den Prozess "{{choice_string}}" ausgewählt. comment this back in if you want to use CHANGE and EXIT process
{% endif %} {% if wizard.steps.step1 > 1 %}
Du hast den Prozess "{{choice_string}}" ausgewählt.
{% endif %}
{% endcomment %}
{{ wizard.management_form }} {{ wizard.management_form }}
{% if wizard.form.forms %} {% if wizard.form.forms %}
{{ wizard.form.management_form }} {{ wizard.form.management_form }}

View File

@ -14,7 +14,7 @@ from .models import Employee, DEPARTMENT_CHOICES, LAPTOP_CHOICES, OS_CHOICES, VE
MOBILE_CHOICES, LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES MOBILE_CHOICES, LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES
from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm,\ from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm,\
ChangeForm, TYPE_CHOICES ChangeForm, TYPE_CHOICES
from .settings import MAILS, EVA_MAIL, BASIC_DATA from .settings import MAILS, EVA_MAIL, BASIC_DATA, ONLY_ONBOARDING
def success(request): def success(request):
return HttpResponse("Vielen Dank! Du hast E.V.A. erfolgreich ausgefüllt. Die Mails an die Abteilungen wurden versendet.") 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): def long_process(wizard):
'''this method is called via urls.py to determine if a form is part of the IN-Process''' '''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 {} if ONLY_ONBOARDING:
print(data)
if data.get('choice') != 'CHANGE':
wizard.set_choice('IN') wizard.set_choice('IN')
print('PROZESS IN')
return True return True
else: else:
wizard.set_choice('CHANGE') data = wizard.get_cleaned_data_for_step('0') or {}
print('PROZESS NOT IN') print(data)
return False 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): def change_process(wizard):
''' this method is called via urls.py to determine if the form is part of the change process''' ''' 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, context.update({'choice': self.choice,
'choice_string': TYPE_CHOICES[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)): 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()), context.update({'data': self.beautify_data(self.get_all_cleaned_data()),
'datatable': True,}) 'datatable': True,})