added field for laptop vendor

This commit is contained in:
Benni Bärmann 2021-02-08 14:46:38 +01:00
parent eb7d71bf69
commit b7742b5629
4 changed files with 26 additions and 3 deletions

View File

@ -41,7 +41,7 @@ class ITForm(EvaForm):
class Meta:
model = Employee
fields = [
'laptop', 'os', 'screen', 'mobile', 'landline', 'comment',
'laptop', 'vendor', 'os', 'screen', 'mobile', 'landline', 'comment',
'language', 'accounts', 'lists', ]
class OfficeForm(EvaForm):

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.4 on 2021-02-08 13:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('evapp', '0004_employee_intern'),
]
operations = [
migrations.AddField(
model_name='employee',
name='vendor',
field=models.CharField(choices=[('STANDARD', 'Dell Latitude'), ('LENOVO', 'Lenovo Thinkpad'), ('MAC', 'Mac (nur in Ausnahmefällen)')], default='STANDARD', max_length=8),
),
]

View File

@ -13,6 +13,10 @@ DEPARTMENT_CHOICES = {'PROG': 'Programme',
LAPTOP_CHOICES = {'14': '14", unser Standardgerät',
'12': '12,5", geeignet für Vielreisende',}
VENDOR_CHOICES = {'STANDARD': 'Dell Latitude',
'LENOVO': 'Lenovo Thinkpad',
'MAC': 'Mac (nur in Ausnahmefällen)'}
OS_CHOICES = {'UBU': 'Ubuntu (Standard)',
'WIN': 'Windows (bitte Begründung angeben)',}
@ -57,6 +61,7 @@ class Employee(models.Model):
# IT related stuff
laptop = models.CharField(max_length=2, choices=LAPTOP_CHOICES.items(), default='14')
vendor = models.CharField(max_length=8, choices=VENDOR_CHOICES.items(), default='STANDARD')
os = models.CharField(max_length=3, choices=OS_CHOICES.items(), default='UBU')
screen = models.BooleanField(default=False, verbose_name='zusätzlicher Monitor? Einer ist standard.')
mobile = models.CharField(max_length=6, default='NO')

View File

@ -9,7 +9,7 @@ from django.template.loader import get_template
from formtools.wizard.views import CookieWizardView
from django.shortcuts import render
from .models import Employee, DEPARTMENT_CHOICES, LAPTOP_CHOICES, OS_CHOICES,\
from .models import Employee, DEPARTMENT_CHOICES, LAPTOP_CHOICES, OS_CHOICES, VENDOR_CHOICES, \
MOBILE_CHOICES, LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES
from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm,\
ChangeForm, TYPE_CHOICES
@ -144,7 +144,7 @@ class EvaFormView(CookieWizardView):
# update values in data dictionary with keys from *_CHOICES if present there
choices = {**DEPARTMENT_CHOICES, **LAPTOP_CHOICES, **TRANSPONDER_CHOICES,
**OS_CHOICES, **MOBILE_CHOICES, **LANG_CHOICES,}
**OS_CHOICES, **MOBILE_CHOICES, **LANG_CHOICES, **VENDOR_CHOICES}
data.update({k:choices[v] for k,v in data.items() \
if isinstance(v,collections.abc.Hashable) \
and v in choices})