From b2493e01b066ab6e2ce01dc29bfdccb4162284e2 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 4 May 2021 12:45:41 +0200 Subject: [PATCH] new field keyboard layout, removed field landline --- evapp/forms.py | 2 +- evapp/migrations/0016_auto_20210504_1040.py | 27 +++++++++++++++++++++ evapp/models.py | 11 ++++++--- evapp/views.py | 10 +++----- 4 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 evapp/migrations/0016_auto_20210504_1040.py diff --git a/evapp/forms.py b/evapp/forms.py index a7a9a4e..3a543a1 100644 --- a/evapp/forms.py +++ b/evapp/forms.py @@ -50,7 +50,7 @@ class ITForm(EvaForm): class Meta: model = Employee fields = [ - 'laptop', 'vendor', 'os', 'screen', 'mobile', 'sim', 'landline', 'comment', + 'laptop', 'vendor', 'os', 'keyboard', 'screen', 'mobile', 'sim', 'comment', 'language', 'accounts', 'lists', 'rebu2go' ] class OfficeForm(EvaForm): diff --git a/evapp/migrations/0016_auto_20210504_1040.py b/evapp/migrations/0016_auto_20210504_1040.py new file mode 100644 index 0000000..5005c9d --- /dev/null +++ b/evapp/migrations/0016_auto_20210504_1040.py @@ -0,0 +1,27 @@ +# Generated by Django 3.1.4 on 2021-05-04 10:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('evapp', '0015_remove_employee_email'), + ] + + operations = [ + migrations.RemoveField( + model_name='employee', + name='landline', + ), + migrations.AddField( + model_name='employee', + name='keyboard', + field=models.CharField(choices=[('DE', 'Deutsch'), ('US', 'USA'), ('OT', 'Anderes (Bitte unten angeben)')], default='DE', max_length=2, verbose_name='Tastaturlayout'), + ), + migrations.AlterField( + model_name='employee', + name='department', + field=models.CharField(choices=[('PROG', 'Programme'), ('SOFT', 'Softwareentwicklung'), ('CENT', 'Central'), ('VOR', 'Vorstand')], max_length=5, verbose_name='Bereich'), + ), + ] diff --git a/evapp/models.py b/evapp/models.py index 79e775d..7df00db 100644 --- a/evapp/models.py +++ b/evapp/models.py @@ -29,6 +29,10 @@ OS_CHOICES = {'UBU': 'Ubuntu (Standard)', LANG_CHOICES = {'GER': 'Deutsch', 'ENG': 'English',} +KEYBOARD_CHOICES = {'DE': 'Deutsch', + 'US': 'USA', + 'OT': 'Anderes (Bitte unten angeben)'} + ACCOUNT_CHOICES = {'OTRSWMDE': 'OTRS Ticketsystem', 'CIVIC1': 'Civic CRM (allgemein)', 'CIVIC2': "Civic CRM (Mailings, impliziert allgemein)", @@ -51,7 +55,7 @@ class Employee(models.Model): lastname = models.CharField(max_length=50, verbose_name="Nachname") intern = models.BooleanField(verbose_name='Interne_r Mitarbeiter_in?', default=True) # email = models.EmailField(max_length=50, verbose_name="E-Mail-Adresse ders Mitarbeitenden") - department = models.CharField(max_length=5, choices=DEPARTMENT_CHOICES.items()) + department = models.CharField(max_length=5, choices=DEPARTMENT_CHOICES.items(), verbose_name='Bereich') team = models.CharField(max_length=20, null=True, blank=True) # TODO? besser als choices? # general work related stuff @@ -69,9 +73,8 @@ class Employee(models.Model): screen = models.BooleanField(default=False, verbose_name='Zusätzlicher Monitor? Einer ist standard.') mobile = models.BooleanField(max_length=6, default=False, verbose_name='Handy benötigt?') sim = models.BooleanField(default=False, verbose_name="Mobilfunkvertrag") - # sim2 = models.BooleanField(default=False, verbose_name="Zweite Sim (für Laptop zB)") # do we still need this? - landline = models.BooleanField(default=True, verbose_name="Festnetztelefon") # do we still need this? - # TODO: tastaturlayout DE/US + # landline = models.BooleanField(default=True, verbose_name="Festnetztelefon") # do we still need this? + keyboard = models.CharField(max_length=2, choices=KEYBOARD_CHOICES.items(), default='DE', verbose_name="Tastaturlayout") comment = models.TextField(max_length=500, null=True, blank=True, verbose_name="zusätzliche IT-Anforderungen") language = models.CharField(max_length=3, choices=LANG_CHOICES.items(), default="GER") accounts = MultiSelectField(choices=ACCOUNT_CHOICES.items(), null=True, blank=True, verbose_name="Zusätzliche Accounts") diff --git a/evapp/views.py b/evapp/views.py index 4c857cb..f973b27 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -12,7 +12,7 @@ from django.conf import settings from django.contrib.auth.mixins import LoginRequiredMixin from .models import Employee, DEPARTMENT_CHOICES, LAPTOP_CHOICES, OS_CHOICES, VENDOR_CHOICES, \ - LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES + LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES, KEYBOARD_CHOICES from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm,\ ChangeForm, TYPE_CHOICES from .settings import MAILS, EVA_MAIL, BASIC_DATA, ONLY_ONBOARDING @@ -56,8 +56,8 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): self.choice = c def generate_email(self, data): - (first, junk) = data['firstname'].split(maxsplit=1) - (last, junk) = data['lastname'].split(maxsplit=1) + (first, *_) = data['firstname'].split(maxsplit=1) + (last, *_) = data['lastname'].split(maxsplit=1) name = first + '.' + last if not data['intern']: mail = name + '_ext@wikimedia.de' @@ -164,11 +164,9 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): # ''' - # print("BEAUTIFY") - # update values in data dictionary with keys from *_CHOICES if present there choices = {**DEPARTMENT_CHOICES, **LAPTOP_CHOICES, **TRANSPONDER_CHOICES, - **OS_CHOICES, **LANG_CHOICES, **VENDOR_CHOICES} + **OS_CHOICES, **LANG_CHOICES, **VENDOR_CHOICES, **KEYBOARD_CHOICES} data.update({k:choices[v] for k,v in data.items() \ if isinstance(v,collections.abc.Hashable) \ and v in choices})