From 02fddf6cc3d3e074074d9d5c0a695e5a8c78862b Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 20 Jan 2021 09:18:18 +0100 Subject: [PATCH] use a single template for all mails. --- evapp/settings.py | 3 +++ evapp/templates/evapp/IT_mail.txt | 1 - evapp/templates/evapp/OFFICE_mail.txt | 1 - evapp/templates/evapp/department_mail.txt | 9 +++++++++ evapp/views.py | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) delete mode 100644 evapp/templates/evapp/IT_mail.txt delete mode 100644 evapp/templates/evapp/OFFICE_mail.txt create mode 100644 evapp/templates/evapp/department_mail.txt diff --git a/evapp/settings.py b/evapp/settings.py index 51626c5..eed6ec0 100644 --- a/evapp/settings.py +++ b/evapp/settings.py @@ -1,7 +1,10 @@ +# sender mail adress EVA_MAIL = 'benni.baermann@wikimedia.de' +# these Fields should be included in every mail BASIC_DATA = ['firstname', 'lastname'] +# for every department: 'MAIL' => mail adress, 'DATA': additional fields to include MAILS = {'IT': { 'MAIL': 'it@wikimedia.de', 'DATA': ['laptop', 'os',], diff --git a/evapp/templates/evapp/IT_mail.txt b/evapp/templates/evapp/IT_mail.txt deleted file mode 100644 index 8b796bd..0000000 --- a/evapp/templates/evapp/IT_mail.txt +++ /dev/null @@ -1 +0,0 @@ -{% include 'evapp/dataloop.txt' %} diff --git a/evapp/templates/evapp/OFFICE_mail.txt b/evapp/templates/evapp/OFFICE_mail.txt deleted file mode 100644 index 8b796bd..0000000 --- a/evapp/templates/evapp/OFFICE_mail.txt +++ /dev/null @@ -1 +0,0 @@ -{% include 'evapp/dataloop.txt' %} diff --git a/evapp/templates/evapp/department_mail.txt b/evapp/templates/evapp/department_mail.txt new file mode 100644 index 0000000..000aea5 --- /dev/null +++ b/evapp/templates/evapp/department_mail.txt @@ -0,0 +1,9 @@ +Hallo! + +Es gibt einen Neuzugang bei Wikimedia! Hier () kannst Du nachsehen, +welche Schritte jetzt für Deine Abteilung nötig werden. Im Folgenden alle Daten, +die Du dafür brauchst: + +{% include 'evapp/dataloop.txt' %} + +Grüße, Deine E.V.A. diff --git a/evapp/views.py b/evapp/views.py index 37fcdd2..c8c0b5f 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -63,7 +63,7 @@ class EvaFormView(CookieWizardView): context = {'data': self.beautify_data(newdata)} try: - mail_template = get_template(f'evapp/{department}_mail.txt') + mail_template = get_template(f'evapp/department_mail.txt') send_mail( 'EVA: Neuzugang', mail_template.render(context),