first steps for data modell

This commit is contained in:
Benni Bärmann 2020-12-23 12:04:08 +01:00
parent 06cd9f63b5
commit c4403bc117
3 changed files with 37 additions and 1 deletions

View File

@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'evapp.apps.EvappConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',

View File

@ -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)),
],
),
]

View File

@ -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)