From 4251fcbc2c5c4d099221b2f69ee02429aaf4d3d0 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 5 May 2021 11:11:34 +0200 Subject: [PATCH] removed "None" and "[]" from last step and mails --- TODO | 2 +- evapp/views.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 8b13789..f3410d1 100644 --- a/TODO +++ b/TODO @@ -1 +1 @@ - +- remove None and [] in the overwiew in last step and in mails diff --git a/evapp/views.py b/evapp/views.py index e606561..4f687b6 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -176,6 +176,7 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): data['accounts'] = [ACCOUNT_CHOICES[c] for c in data['accounts']] # replace keys in data dictionary with verbose_name + # a bit ugly workaround here: we need to store 'email' away, because it es not in the modell mail = '' if 'email' in data: mail = data.pop('email') @@ -183,8 +184,11 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): if mail: newdata['Email'] = mail - #translate booleans + # translate booleans newdata.update({k:'Ja' for k,v in newdata.items() if isinstance(v,bool) and v == True}) newdata.update({k:'Nein' for k,v in newdata.items() if isinstance(v,bool) and v == False}) + # handle some special data types + newdata.update({k:'' for k,v in newdata.items() if v == None}) + newdata.update({k:'' for k,v in newdata.items() if v == []}) return newdata