From 6352064931eb503c96c2bb86733e2e7a76e765b7 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 18 May 2021 09:42:00 +0200 Subject: [PATCH] usermail fix in mail templates --- TODO | 2 ++ evapp/settings.py | 2 +- evapp/templates/evapp/department_mail.txt | 2 ++ evapp/views.py | 7 ++++--- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 03b33fd..18f1dfc 100644 --- a/TODO +++ b/TODO @@ -1 +1,3 @@ * remove dot before "Nextcloud" at login page. + +* Datumsformat bei Ausgabe ist englisch nicht deutsch. diff --git a/evapp/settings.py b/evapp/settings.py index 9156433..6cfeb45 100644 --- a/evapp/settings.py +++ b/evapp/settings.py @@ -5,7 +5,7 @@ ONLY_ONBOARDING = True EVA_MAIL = 'benni.baermann@wikimedia.de' # these Fields should be included in every mail -BASIC_DATA = ['usermail', 'firstname', 'lastname', 'firstdate_employment', 'firstdate_presence',] +BASIC_DATA = ['firstname', 'lastname', 'firstdate_employment', 'firstdate_presence',] # for every department: 'MAIL' => mail adress, 'DATA': additional fields to include MAILS = { diff --git a/evapp/templates/evapp/department_mail.txt b/evapp/templates/evapp/department_mail.txt index e2a2213..c70ba07 100644 --- a/evapp/templates/evapp/department_mail.txt +++ b/evapp/templates/evapp/department_mail.txt @@ -6,4 +6,6 @@ die Du dafür brauchst: {% include 'evapp/dataloop.txt' %} +Wenn Du Fragen hast, melde Dich bei {{contact}}. + Grüße, Deine E.V.A. diff --git a/evapp/views.py b/evapp/views.py index b0c35c7..b2fbb95 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -125,13 +125,14 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): print(f'send mail to department {department}...') + contact = self.request.user.email data = self.get_all_cleaned_data() # some data should be in every mail newdata = {k: v for k, v in data.items() if (k in BASIC_DATA)} # only the relevant data should be in the context newdata.update({k: v for k, v in data.items() if (k in MAILS[department]['DATA'])}) - context = {'data': self.beautify_data(newdata)} + context = {'data': self.beautify_data(newdata), 'contact': contact} try: mail_template = get_template(f'evapp/department_mail.txt') @@ -140,14 +141,14 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): 'EVA: Neuzugang', mail_template.render(context), EVA_MAIL, - [EVA_MAIL, self.request.user.email], + [EVA_MAIL, contact], fail_silently=False) else: send_mail( 'EVA: Neuzugang', mail_template.render(context), EVA_MAIL, - [MAILS[department]['MAIL'], self.request.user.email], + [MAILS[department]['MAIL'], contact], fail_silently=False) except BadHeaderError: self.instance.delete()