From f131d4d0c94840b9e3eae1b7368e0eb312aa28b4 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Thu, 25 Mar 2021 10:09:27 +0100 Subject: [PATCH] new setting MAILTEST which sends mail only to EVA_MAIL not to departments --- TODO | 4 ++-- eva/settings_development.py | 3 +++ eva/settings_production.py | 6 +++--- evapp/settings.py | 2 +- evapp/views.py | 10 +++++++++- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 110e3f7..f9a5579 100644 --- a/TODO +++ b/TODO @@ -2,10 +2,10 @@ known bugs: html problem in mails: 14" -> 14" -stellenbeschreibung -> stellenbezeichnung - evapp/settings auf die richtigen adressen setzen Accounts klären mail in production testen + +Bemerkung like "E - VA soon" auf die webseite diff --git a/eva/settings_development.py b/eva/settings_development.py index c2de6d1..10775f7 100644 --- a/eva/settings_development.py +++ b/eva/settings_development.py @@ -27,6 +27,9 @@ SECRET_KEY = 'g%+i6+gkwt3zz@+k-5x1dtstuw4)&qd$lxd^bt2oswy5e1#dul' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True +# send mails only to debug mode adress even if in production +MAILTEST = True + STATIC_ROOT = BASE_DIR / 'staticfiles' ALLOWED_HOSTS = ['*'] diff --git a/eva/settings_production.py b/eva/settings_production.py index 0e61c92..768460f 100644 --- a/eva/settings_production.py +++ b/eva/settings_production.py @@ -49,15 +49,15 @@ SECRET_KEY = get_secret('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False +# send mails only to debug mode adress even if in production +MAILTEST = True + # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! # SECRET_KEY = 'g%+i6+gkwt3zz@+k-5x1dtstuw4)&qd$lxd^bt2oswy5e1#dul' -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False - STATIC_ROOT = BASE_DIR / 'staticfiles' ALLOWED_HOSTS = ['*'] diff --git a/evapp/settings.py b/evapp/settings.py index ff4ac6a..514b771 100644 --- a/evapp/settings.py +++ b/evapp/settings.py @@ -1,7 +1,7 @@ # temporary setting while change and exit is not yet fully implemented ONLY_ONBOARDING = True -# sender mail adress +# sender mail adress also used for MAILTEST mode EVA_MAIL = 'benni.baermann@wikimedia.de' # these Fields should be included in every mail diff --git a/evapp/views.py b/evapp/views.py index e1ec93c..9d93e33 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -130,7 +130,15 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): try: mail_template = get_template(f'evapp/department_mail.txt') - send_mail( + if settings.MAILTEST: + send_mail( + 'EVA: Neuzugang', + mail_template.render(context), + EVA_MAIL, + [EVA_MAIL, self.instance.usermail], + fail_silently=False) + else: + send_mail( 'EVA: Neuzugang', mail_template.render(context), EVA_MAIL,