True/False => Ja/Nein in data, slightly changed verbose_name for usermail

This commit is contained in:
Benni Bärmann 2021-05-04 14:51:21 +02:00
parent 3073322290
commit db36e1cdc9
4 changed files with 25 additions and 4 deletions

2
TODO
View File

@ -1,3 +1 @@
- in mail ändern "Deine mailadresse" in "ansprechpartner_in"
- true/false übersetzen in dataloop

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.4 on 2021-05-04 12:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('evapp', '0017_auto_20210504_1224'),
]
operations = [
migrations.AlterField(
model_name='employee',
name='usermail',
field=models.EmailField(default='bestechefin@wikimedia.de', max_length=50, verbose_name='Deine Mailadresse (Ansprechpartner_in)'),
),
]

View File

@ -48,7 +48,7 @@ TRANSPONDER_CHOICES = {'NORM': 'Allgemeiner Transponder',
class Employee(models.Model): class Employee(models.Model):
# email adress of user. should not be necessary if we use openauth one day # email adress of user. should not be necessary if we use openauth one day
usermail = models.EmailField(max_length=50, verbose_name="Deine Mailadresse", default='bestechefin@wikimedia.de') usermail = models.EmailField(max_length=50, verbose_name="Deine Mailadresse (Ansprechpartner_in)", default='bestechefin@wikimedia.de')
# personal data # personal data
firstname = models.CharField(max_length=50, verbose_name="Vorname") firstname = models.CharField(max_length=50, verbose_name="Vorname")

View File

@ -181,5 +181,10 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
mail = data.pop('email') mail = data.pop('email')
newdata = {self.instance._meta.get_field(k).verbose_name.title() : v for k,v in data.items()} newdata = {self.instance._meta.get_field(k).verbose_name.title() : v for k,v in data.items()}
if mail: if mail:
newdata['email'] = mail newdata['Email'] = mail
#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})
return newdata return newdata