change email if employee is extern and mail does not end with _ext
This commit is contained in:
parent
70b849ffd6
commit
eb7d71bf69
|
@ -7,7 +7,7 @@ BASIC_DATA = ['firstname', 'lastname']
|
||||||
# for every department: 'MAIL' => mail adress, 'DATA': additional fields to include
|
# for every department: 'MAIL' => mail adress, 'DATA': additional fields to include
|
||||||
MAILS = {'IT': {
|
MAILS = {'IT': {
|
||||||
'MAIL': 'it@wikimedia.de',
|
'MAIL': 'it@wikimedia.de',
|
||||||
'DATA': ['laptop', 'os',],
|
'DATA': ['laptop', 'os', 'email'],
|
||||||
},
|
},
|
||||||
'OFFICE': {
|
'OFFICE': {
|
||||||
'MAIL': 'office@wikimedia.de',
|
'MAIL': 'office@wikimedia.de',
|
||||||
|
|
|
@ -51,9 +51,16 @@ class EvaFormView(CookieWizardView):
|
||||||
|
|
||||||
|
|
||||||
def get_all_cleaned_data(self):
|
def get_all_cleaned_data(self):
|
||||||
'''this method deletes data which is only used temporary and is not in the modell'''
|
'''this method deletes data which is only used temporary and is not in the modell,
|
||||||
|
it also changes the mail adress of the employee in some circumstances'''
|
||||||
|
|
||||||
data = super().get_all_cleaned_data()
|
data = super().get_all_cleaned_data()
|
||||||
|
if not data['intern']:
|
||||||
|
print("intern employee detected")
|
||||||
|
if not data['email'].endswith('_ext'):
|
||||||
|
print('added "_ext" to mail adress')
|
||||||
|
data['email'] += '_ext'
|
||||||
|
|
||||||
print("delete CHOICE FROM DATA")
|
print("delete CHOICE FROM DATA")
|
||||||
if 'choice' in data:
|
if 'choice' in data:
|
||||||
del data['choice']
|
del data['choice']
|
||||||
|
@ -80,6 +87,7 @@ class EvaFormView(CookieWizardView):
|
||||||
self.instance = Employee()
|
self.instance = Employee()
|
||||||
return self.instance
|
return self.instance
|
||||||
|
|
||||||
|
|
||||||
def done(self, form_list, **kwargs):
|
def done(self, form_list, **kwargs):
|
||||||
'''this method is called from CookieWizardView after all forms are filled'''
|
'''this method is called from CookieWizardView after all forms are filled'''
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue