From c4403bc117a5050ad5a286e325311507123238bc Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 23 Dec 2020 12:04:08 +0100 Subject: [PATCH] first steps for data modell --- eva/settings.py | 1 + evapp/migrations/0001_initial.py | 25 +++++++++++++++++++++++++ evapp/models.py | 12 +++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 evapp/migrations/0001_initial.py diff --git a/eva/settings.py b/eva/settings.py index 2250258..b347748 100644 --- a/eva/settings.py +++ b/eva/settings.py @@ -31,6 +31,7 @@ ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + 'evapp.apps.EvappConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', diff --git a/evapp/migrations/0001_initial.py b/evapp/migrations/0001_initial.py new file mode 100644 index 0000000..c1c9965 --- /dev/null +++ b/evapp/migrations/0001_initial.py @@ -0,0 +1,25 @@ +# Generated by Django 3.1.4 on 2020-12-23 11:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Employee', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('firstname', models.CharField(max_length=50, verbose_name='Vorname')), + ('lastname', models.CharField(max_length=50, verbose_name='Nachname')), + ('email', models.CharField(max_length=50, verbose_name='E-Mail-Adresse')), + ('department', models.CharField(choices=[('PROG', 'Programme'), ('SOFT', 'Softwareentwicklung'), ('CENT', 'Central'), ('VOR', 'Vorstand')], max_length=5)), + ('team', models.CharField(blank=True, max_length=20, null=True)), + ], + ), + ] diff --git a/evapp/models.py b/evapp/models.py index 71a8362..164e6df 100644 --- a/evapp/models.py +++ b/evapp/models.py @@ -1,3 +1,13 @@ from django.db import models -# Create your models here. +DEPARTMENT_CHOICES = {'PROG': 'Programme', + 'SOFT': 'Softwareentwicklung', + 'CENT': 'Central', + 'VOR': 'Vorstand',} + +class Employee(models.Model): + firstname = models.CharField(max_length=50, verbose_name="Vorname") + lastname = models.CharField(max_length=50, verbose_name="Nachname") + email = models.CharField(max_length=50, verbose_name="E-Mail-Adresse") + department = models.CharField(max_length=5, choices=DEPARTMENT_CHOICES.items()) + team = models.CharField(max_length=20, null=True, blank=True)