WMDE
/
eva
forked from tohe/eva
7
1
Fork 0

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'}
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

View File

@ -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'

View File

@ -60,9 +60,12 @@
<form action="" method="post">
{% csrf_token %}
<table>
{% 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 }}

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
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')