From 96dc73539f513d2628a5a4463aadfdb18435c79a Mon Sep 17 00:00:00 2001 From: Julian Hahn Date: Tue, 10 Dec 2024 09:26:19 +0100 Subject: [PATCH] New questions - by Eya & Julian --- evapp/forms.py | 8 +---- ...oyee_vendor_employee_framework_and_more.py | 32 +++++++++++++++++++ evapp/models.py | 24 ++++++++------ evapp/views.py | 4 +-- 4 files changed, 49 insertions(+), 19 deletions(-) create mode 100644 evapp/migrations/0006_remove_employee_vendor_employee_framework_and_more.py diff --git a/evapp/forms.py b/evapp/forms.py index 0d08b42..662df53 100644 --- a/evapp/forms.py +++ b/evapp/forms.py @@ -48,16 +48,10 @@ class WorkingForm(EvaForm): class ITForm(EvaForm): - def clean(self): - data = self.cleaned_data - if data['vendor'] == 'MAC' and data['os'] != 'MOS': - raise ValidationError('Ein MAC sollte Mac OS installiert haben') - return data - class Meta: model = Employee fields = [ - 'vendor', 'os', 'keyboard', 'screen', 'mobile', 'landline', + 'framework', 'os', 'keyboard', 'mobile', 'landline', 'comment', 'language', 'accounts', 'lists', 'rebu2go' ] class OfficeForm(EvaForm): diff --git a/evapp/migrations/0006_remove_employee_vendor_employee_framework_and_more.py b/evapp/migrations/0006_remove_employee_vendor_employee_framework_and_more.py new file mode 100644 index 0000000..b34e5fd --- /dev/null +++ b/evapp/migrations/0006_remove_employee_vendor_employee_framework_and_more.py @@ -0,0 +1,32 @@ +# Generated by Django 4.2.16 on 2024-11-26 09:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('evapp', '0005_alter_employee_accounts'), + ] + + operations = [ + migrations.RemoveField( + model_name='employee', + name='vendor', + ), + migrations.AddField( + model_name='employee', + name='framework', + field=models.CharField(blank=True, max_length=300, null=True, verbose_name='Möchten Sie vom Standard des Frameworks abweichen, und wenn ja, warum?'), + ), + migrations.AlterField( + model_name='employee', + name='add_to_wikimediade', + field=models.CharField(choices=[('NEIN', 'Nein'), ('JA', 'Ja')], default=True, max_length=5, verbose_name='Soll die Person bei Ansprechpartner*innen auf der WMDE-Webseite mit aufgenommen werden?'), + ), + migrations.AlterField( + model_name='employee', + name='os', + field=models.CharField(choices=[('FED', 'Fedora (Standard)'), ('WIN', 'Windows (bitte Begründung angeben)'), ('MOS', 'Mac OS (nur wenn Mac gewählt)'), ('UBU', 'Ubuntu')], default='FED', max_length=3, verbose_name='Betriebssystem'), + ), + ] diff --git a/evapp/models.py b/evapp/models.py index a661dc2..e07fcac 100644 --- a/evapp/models.py +++ b/evapp/models.py @@ -13,14 +13,14 @@ DEPARTMENT_CHOICES = {'COENG': _('Communitys & Engagement'), 'KOMAD': _('Kommunikation & Advocacy'), 'VOR': _('Vorstand'),} -VENDOR_CHOICES = {'STANDARD': 'Dell Latitude', - 'LENOVO': 'Lenovo Thinkpad', - 'MAC': _('Mac (nur für Grafiker_innen)')} +#VENDOR_CHOICES = {'STANDARD': 'Dell Latitude', +# 'LENOVO': 'Lenovo Thinkpad', +# 'MAC': _('Mac (nur für Grafiker_innen)')} -OS_CHOICES = {'UBU': 'Ubuntu (Standard)', +OS_CHOICES = {'FED': 'Fedora (Standard)', 'WIN': _('Windows (bitte Begründung angeben)'), - 'MOS': _('Mac OS (nur wenn Mac gewählt)')} - + 'MOS': _('Mac OS (nur wenn Mac gewählt)'), + 'UBU': _('Ubuntu')} LANG_CHOICES = {'GER': 'Deutsch', 'ENG': 'English',} @@ -41,6 +41,9 @@ TRANSPONDER_CHOICES = {'NORM': _('Allgemeiner Transponder'), 'SPECIAL': _('Besondere Schließungen (bitte angeben)'), 'NOTRANS': _('Kein Transponder'),} +JANEIN_CHOICES = {'NEIN': ('Nein'), + 'JA': _('Ja'),} + class Employee(models.Model): # email adress of user. should not be necessary if we use openauth one day @@ -52,7 +55,7 @@ class Employee(models.Model): # intern = models.BooleanField(verbose_name='Interne_r Mitarbeiter_in?', default=True) department = models.CharField(max_length=5, choices=DEPARTMENT_CHOICES.items(), verbose_name=_('Bereich')) team = models.CharField(max_length=50, null=True, blank=True) # TODO? better with choices? - add_to_wikimediade = models.BooleanField(default = False, verbose_name=_('Soll auf wikimedia.de irgendwo stehen?')) + add_to_wikimediade = models.CharField(max_length=5, choices=JANEIN_CHOICES.items(), verbose_name=_("Soll die Person bei Ansprechpartner*innen auf der WMDE-Webseite mit aufgenommen werden?")) # general work related stuff firstdate_employment = models.DateField(null=True, verbose_name=_("Erster Arbeitstag")) @@ -63,9 +66,10 @@ class Employee(models.Model): desk = models.CharField(max_length=100, null=True, blank=True, verbose_name=_("Wo soll der Arbeitsplatz sein?")) # IT related stuff - vendor = models.CharField(max_length=8, choices=VENDOR_CHOICES.items(), default='STANDARD', verbose_name=_('Hersteller')) - os = models.CharField(max_length=3, choices=OS_CHOICES.items(), default='UBU', verbose_name=_('Betriebssystem')) - screen = models.BooleanField(default=False, verbose_name=_('Zusätzlicher Monitor? Einer ist standard.')) + #vendor = models.CharField(max_length=8, choices=VENDOR_CHOICES.items(), default='STANDARD', verbose_name=_('Hersteller')) + framework = models.CharField(max_length=300, null=True, blank=True, verbose_name=_("Möchten Sie vom Standard des Frameworks (Laptop) abweichen, und wenn ja, warum?")) + os = models.CharField(max_length=3, choices=OS_CHOICES.items(), default='FED', verbose_name=_('Betriebssystem')) + #screen = models.BooleanField(default=False, verbose_name=_('Zusätzlicher Monitor? Einer ist standard.')) mobile = models.BooleanField(max_length=6, default=False, verbose_name=_('Diensttelefon (Handy)')) landline = models.BooleanField(default = False, verbose_name=_('Festnetznummer (Sipgate)')) # sim = models.BooleanField(default=False, verbose_name="Mobilfunkvertrag") diff --git a/evapp/views.py b/evapp/views.py index f7b8689..6da4f7a 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -12,8 +12,8 @@ from django.conf import settings from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.translation import gettext_lazy as _ -from .models import Employee, DEPARTMENT_CHOICES, OS_CHOICES, VENDOR_CHOICES, \ - LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES, KEYBOARD_CHOICES +from .models import Employee, DEPARTMENT_CHOICES, OS_CHOICES, \ + LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES, KEYBOARD_CHOICES, JANEIN_CHOICES from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm,\ ChangeForm, TYPE_CHOICES from .settings import MAILS, EVA_MAIL, BASIC_DATA, ONLY_ONBOARDING