From 910c24f70366d3de514c214d754926f608da6ca5 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 4 May 2021 12:16:01 +0200 Subject: [PATCH] removed empty lines in mails. bugfix regarding mail generation --- TODO | 2 -- evapp/templates/evapp/dataloop.txt | 9 ++------- evapp/views.py | 7 +++++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index d3e74b2..2b913ba 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ -- remove empty lines in mail - - in mail ändern "Deine mailadresse" in "ansprechpartner_in" - true/false übersetzen in dataloop diff --git a/evapp/templates/evapp/dataloop.txt b/evapp/templates/evapp/dataloop.txt index a0b1b94..b4c89a5 100644 --- a/evapp/templates/evapp/dataloop.txt +++ b/evapp/templates/evapp/dataloop.txt @@ -1,9 +1,4 @@ {% autoescape off %} -{% for key, value in data.items %} - {% if key == 'laptop' %} - {{ key }}: {{ value | safe}} - {% else %} - {{ key }}: {{ value }} - {% endif %} -{% endfor %} +{% for key, value in data.items %}{% if key == 'laptop' %} {{ key }}: {{ value | safe}}{% else %} +{{ key }}: {{ value }}{% endif %}{% endfor %} {% endautoescape %} diff --git a/evapp/views.py b/evapp/views.py index 82bd80e..4c857cb 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -178,7 +178,10 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): data['accounts'] = [ACCOUNT_CHOICES[c] for c in data['accounts']] # replace keys in data dictionary with verbose_name - mail = data.pop('email') + mail = '' + if 'email' in data: + mail = data.pop('email') newdata = {self.instance._meta.get_field(k).verbose_name.title() : v for k,v in data.items()} - newdata['email'] = mail + if mail: + newdata['email'] = mail return newdata