]> Johnzone git - Mannschaftsverwaltung.git/commitdiff
initial commit, model maybe done
authorJohn Janus <mail@johnzone.org>
Mon, 5 Nov 2018 23:01:46 +0000 (00:01 +0100)
committerJohn Janus <mail@johnzone.org>
Mon, 5 Nov 2018 23:01:46 +0000 (00:01 +0100)
22 files changed:
.gitignore [new file with mode: 0644]
.kdev4/Mannschaftsverwaltung.kdev4 [new file with mode: 0644]
Mannschaftsverwaltung.kdev4 [new file with mode: 0644]
Mannschaftsverwaltung/__init__.py [new file with mode: 0644]
Mannschaftsverwaltung/settings.py [new file with mode: 0644]
Mannschaftsverwaltung/urls.py [new file with mode: 0644]
Mannschaftsverwaltung/wsgi.py [new file with mode: 0644]
manage.py [new file with mode: 0755]
mannschaft/__init__.py [new file with mode: 0644]
mannschaft/admin.py [new file with mode: 0644]
mannschaft/apps.py [new file with mode: 0644]
mannschaft/migrations/0001_initial.py [new file with mode: 0644]
mannschaft/migrations/0002_player_user.py [new file with mode: 0644]
mannschaft/migrations/0003_auto_20181103_0242.py [new file with mode: 0644]
mannschaft/migrations/0004_auto_20181103_1501.py [new file with mode: 0644]
mannschaft/migrations/0005_auto_20181103_1503.py [new file with mode: 0644]
mannschaft/migrations/0006_auto_20181103_1505.py [new file with mode: 0644]
mannschaft/migrations/__init__.py [new file with mode: 0644]
mannschaft/models.py [new file with mode: 0644]
mannschaft/tests.py [new file with mode: 0644]
mannschaft/urls.py [new file with mode: 0644]
mannschaft/views.py [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..2f78cf5
--- /dev/null
@@ -0,0 +1,2 @@
+*.pyc
+
diff --git a/.kdev4/Mannschaftsverwaltung.kdev4 b/.kdev4/Mannschaftsverwaltung.kdev4
new file mode 100644 (file)
index 0000000..65ab94e
--- /dev/null
@@ -0,0 +1,5 @@
+[Buildset]
+BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00*\x00M\x00a\x00n\x00n\x00s\x00c\x00h\x00a\x00f\x00t\x00s\x00v\x00e\x00r\x00w\x00a\x00l\x00t\x00u\x00n\x00g)
+
+[Project]
+VersionControlSupport=kdevgit
diff --git a/Mannschaftsverwaltung.kdev4 b/Mannschaftsverwaltung.kdev4
new file mode 100644 (file)
index 0000000..f0435b8
--- /dev/null
@@ -0,0 +1,4 @@
+[Project]
+CreatedFrom=
+Manager=KDevCustomBuildSystem
+Name=Mannschaftsverwaltung
diff --git a/Mannschaftsverwaltung/__init__.py b/Mannschaftsverwaltung/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/Mannschaftsverwaltung/settings.py b/Mannschaftsverwaltung/settings.py
new file mode 100644 (file)
index 0000000..f2842d7
--- /dev/null
@@ -0,0 +1,126 @@
+"""
+Django settings for Mannschaftsverwaltung project.
+
+Generated by 'django-admin startproject' using Django 2.1.3.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/2.1/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/2.1/ref/settings/
+"""
+
+import os
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = '%h#2n%2o!dtc6^w75mpegb)+^xpse+=p6zmgwbx^!v$j#o5$vu'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+    'mannschaft.apps.MannschaftConfig',
+    'django.contrib.admin',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+]
+
+MIDDLEWARE = [
+    'django.middleware.security.SecurityMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.common.CommonMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'Mannschaftsverwaltung.urls'
+
+TEMPLATES = [
+    {
+        'BACKEND': 'django.template.backends.django.DjangoTemplates',
+        'DIRS': [],
+        'APP_DIRS': True,
+        'OPTIONS': {
+            'context_processors': [
+                'django.template.context_processors.debug',
+                'django.template.context_processors.request',
+                'django.contrib.auth.context_processors.auth',
+                'django.contrib.messages.context_processors.messages',
+            ],
+        },
+    },
+]
+
+WSGI_APPLICATION = 'Mannschaftsverwaltung.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
+
+DATABASES = {
+    'default': {
+        # 'ENGINE': 'django.db.backends.sqlite3',
+        # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+        'ENGINE': 'django.db.backends.mysql',
+        'NAME': 'mannschaft',
+        'USER': 'mannschaft',
+        'PASSWORD': 'ahY3thei',
+        'HOST': 'localhost',
+    }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+    {
+        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+    },
+    {
+        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+    },
+    {
+        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+    },
+    {
+        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+    },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/2.1/topics/i18n/
+
+LANGUAGE_CODE = 'de-de'
+
+TIME_ZONE = 'Europe/Berlin'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/2.1/howto/static-files/
+
+STATIC_URL = '/static/'
diff --git a/Mannschaftsverwaltung/urls.py b/Mannschaftsverwaltung/urls.py
new file mode 100644 (file)
index 0000000..1f97b2d
--- /dev/null
@@ -0,0 +1,22 @@
+"""Mannschaftsverwaltung URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+    https://docs.djangoproject.com/en/2.1/topics/http/urls/
+Examples:
+Function views
+    1. Add an import:  from my_app import views
+    2. Add a URL to urlpatterns:  path('', views.home, name='home')
+Class-based views
+    1. Add an import:  from other_app.views import Home
+    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
+Including another URLconf
+    1. Import the include() function: from django.urls import include, path
+    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import include, path
+
+urlpatterns = [
+    path('mannschaft/', include('mannschaft.urls')),
+    path('admin/', admin.site.urls),
+]
diff --git a/Mannschaftsverwaltung/wsgi.py b/Mannschaftsverwaltung/wsgi.py
new file mode 100644 (file)
index 0000000..46b2f42
--- /dev/null
@@ -0,0 +1,16 @@
+"""
+WSGI config for Mannschaftsverwaltung project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Mannschaftsverwaltung.settings')
+
+application = get_wsgi_application()
diff --git a/manage.py b/manage.py
new file mode 100755 (executable)
index 0000000..ca29709
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+import os
+import sys
+
+if __name__ == '__main__':
+    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Mannschaftsverwaltung.settings')
+    try:
+        from django.core.management import execute_from_command_line
+    except ImportError as exc:
+        raise ImportError(
+            "Couldn't import Django. Are you sure it's installed and "
+            "available on your PYTHONPATH environment variable? Did you "
+            "forget to activate a virtual environment?"
+        ) from exc
+    execute_from_command_line(sys.argv)
diff --git a/mannschaft/__init__.py b/mannschaft/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mannschaft/admin.py b/mannschaft/admin.py
new file mode 100644 (file)
index 0000000..54ba386
--- /dev/null
@@ -0,0 +1,6 @@
+from django.contrib import admin
+
+from .models import Team, Location
+
+admin.site.register(Team)
+admin.site.register(Location)
diff --git a/mannschaft/apps.py b/mannschaft/apps.py
new file mode 100644 (file)
index 0000000..949d125
--- /dev/null
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class MannschaftConfig(AppConfig):
+    name = 'mannschaft'
diff --git a/mannschaft/migrations/0001_initial.py b/mannschaft/migrations/0001_initial.py
new file mode 100644 (file)
index 0000000..5e45979
--- /dev/null
@@ -0,0 +1,123 @@
+# Generated by Django 2.1.3 on 2018-11-03 01:05
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Event',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('begin', models.DateTimeField()),
+                ('end', models.DateTimeField()),
+                ('optional', models.TextField()),
+            ],
+        ),
+        migrations.CreateModel(
+            name='Location',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('name', models.CharField(max_length=50)),
+                ('street', models.CharField(max_length=100)),
+                ('zip', models.IntegerField()),
+                ('city', models.CharField(max_length=100)),
+                ('additional', models.CharField(max_length=100)),
+            ],
+        ),
+        migrations.CreateModel(
+            name='Player',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('name', models.CharField(max_length=50)),
+                ('firstname', models.CharField(max_length=50)),
+                ('birthdate', models.DateField()),
+                ('dsvid', models.IntegerField()),
+            ],
+        ),
+        migrations.CreateModel(
+            name='PlayerState',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('state', models.CharField(max_length=1)),
+                ('reason', models.CharField(max_length=180)),
+            ],
+        ),
+        migrations.CreateModel(
+            name='Task',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('task', models.TextField()),
+            ],
+        ),
+        migrations.CreateModel(
+            name='Team',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('name', models.CharField(max_length=50)),
+                ('min_age', models.IntegerField(default=0)),
+                ('max_age', models.IntegerField(default=999)),
+                ('players', models.ManyToManyField(to='mannschaft.Player')),
+            ],
+        ),
+        migrations.CreateModel(
+            name='Game',
+            fields=[
+                ('event_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='mannschaft.Event')),
+                ('home', models.BooleanField()),
+                ('opponent', models.CharField(max_length=50)),
+                ('score_team', models.IntegerField()),
+                ('score_opponent', models.IntegerField()),
+            ],
+            bases=('mannschaft.event',),
+        ),
+        migrations.CreateModel(
+            name='Training',
+            fields=[
+                ('event_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='mannschaft.Event')),
+            ],
+            bases=('mannschaft.event',),
+        ),
+        migrations.AddField(
+            model_name='task',
+            name='event',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mannschaft.Event'),
+        ),
+        migrations.AddField(
+            model_name='task',
+            name='player',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mannschaft.Player'),
+        ),
+        migrations.AddField(
+            model_name='playerstate',
+            name='game',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mannschaft.Event'),
+        ),
+        migrations.AddField(
+            model_name='playerstate',
+            name='player',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mannschaft.Player'),
+        ),
+        migrations.AddField(
+            model_name='event',
+            name='location',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mannschaft.Location'),
+        ),
+        migrations.AddField(
+            model_name='event',
+            name='tasks',
+            field=models.ManyToManyField(through='mannschaft.Task', to='mannschaft.Player'),
+        ),
+        migrations.AddField(
+            model_name='event',
+            name='team',
+            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mannschaft.Team'),
+        ),
+    ]
diff --git a/mannschaft/migrations/0002_player_user.py b/mannschaft/migrations/0002_player_user.py
new file mode 100644 (file)
index 0000000..518dada
--- /dev/null
@@ -0,0 +1,21 @@
+# Generated by Django 2.1.3 on 2018-11-03 01:17
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+        ('mannschaft', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='player',
+            name='user',
+            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
+        ),
+    ]
diff --git a/mannschaft/migrations/0003_auto_20181103_0242.py b/mannschaft/migrations/0003_auto_20181103_0242.py
new file mode 100644 (file)
index 0000000..95808c6
--- /dev/null
@@ -0,0 +1,40 @@
+# Generated by Django 2.1.3 on 2018-11-03 01:42
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('mannschaft', '0002_player_user'),
+    ]
+
+    operations = [
+        migrations.RenameField(
+            model_name='playerstate',
+            old_name='game',
+            new_name='event',
+        ),
+        migrations.AddField(
+            model_name='event',
+            name='state',
+            field=models.ManyToManyField(related_name='event_player_state', through='mannschaft.PlayerState', to='mannschaft.Player'),
+        ),
+        migrations.AddField(
+            model_name='team',
+            name='trainers',
+            field=models.ManyToManyField(related_name='trainers', to='mannschaft.Player'),
+        ),
+        migrations.AlterField(
+            model_name='player',
+            name='user',
+            field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
+        ),
+        migrations.AlterField(
+            model_name='playerstate',
+            name='state',
+            field=models.CharField(choices=[('y', 'Ja'), ('n', 'Nein'), ('p', 'Vielleicht')], max_length=1),
+        ),
+    ]
diff --git a/mannschaft/migrations/0004_auto_20181103_1501.py b/mannschaft/migrations/0004_auto_20181103_1501.py
new file mode 100644 (file)
index 0000000..5531388
--- /dev/null
@@ -0,0 +1,89 @@
+# Generated by Django 2.1.3 on 2018-11-03 14:01
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('mannschaft', '0003_auto_20181103_0242'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='event',
+            name='location',
+            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='mannschaft.Location'),
+        ),
+        migrations.AlterField(
+            model_name='event',
+            name='optional',
+            field=models.TextField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='event',
+            name='state',
+            field=models.ManyToManyField(blank=True, null=True, related_name='event_player_state', through='mannschaft.PlayerState', to='mannschaft.Player'),
+        ),
+        migrations.AlterField(
+            model_name='event',
+            name='tasks',
+            field=models.ManyToManyField(blank=True, null=True, through='mannschaft.Task', to='mannschaft.Player'),
+        ),
+        migrations.AlterField(
+            model_name='game',
+            name='score_opponent',
+            field=models.IntegerField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='game',
+            name='score_team',
+            field=models.IntegerField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='location',
+            name='additional',
+            field=models.CharField(blank=True, max_length=100, null=True),
+        ),
+        migrations.AlterField(
+            model_name='location',
+            name='city',
+            field=models.CharField(blank=True, max_length=100, null=True),
+        ),
+        migrations.AlterField(
+            model_name='location',
+            name='street',
+            field=models.CharField(blank=True, max_length=100, null=True),
+        ),
+        migrations.AlterField(
+            model_name='location',
+            name='zip',
+            field=models.IntegerField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='player',
+            name='birthdate',
+            field=models.DateField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='player',
+            name='dsvid',
+            field=models.IntegerField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='playerstate',
+            name='reason',
+            field=models.CharField(blank=True, max_length=180, null=True),
+        ),
+        migrations.AlterField(
+            model_name='team',
+            name='max_age',
+            field=models.IntegerField(blank=True, default=999, null=True),
+        ),
+        migrations.AlterField(
+            model_name='team',
+            name='min_age',
+            field=models.IntegerField(blank=True, default=0, null=True),
+        ),
+    ]
diff --git a/mannschaft/migrations/0005_auto_20181103_1503.py b/mannschaft/migrations/0005_auto_20181103_1503.py
new file mode 100644 (file)
index 0000000..8b3ca13
--- /dev/null
@@ -0,0 +1,23 @@
+# Generated by Django 2.1.3 on 2018-11-03 14:03
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('mannschaft', '0004_auto_20181103_1501'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='event',
+            name='state',
+            field=models.ManyToManyField(blank=True, related_name='event_player_state', through='mannschaft.PlayerState', to='mannschaft.Player'),
+        ),
+        migrations.AlterField(
+            model_name='event',
+            name='tasks',
+            field=models.ManyToManyField(blank=True, through='mannschaft.Task', to='mannschaft.Player'),
+        ),
+    ]
diff --git a/mannschaft/migrations/0006_auto_20181103_1505.py b/mannschaft/migrations/0006_auto_20181103_1505.py
new file mode 100644 (file)
index 0000000..24af96f
--- /dev/null
@@ -0,0 +1,23 @@
+# Generated by Django 2.1.3 on 2018-11-03 14:05
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('mannschaft', '0005_auto_20181103_1503'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='team',
+            name='players',
+            field=models.ManyToManyField(blank=True, to='mannschaft.Player'),
+        ),
+        migrations.AlterField(
+            model_name='team',
+            name='trainers',
+            field=models.ManyToManyField(blank=True, related_name='trainers', to='mannschaft.Player'),
+        ),
+    ]
diff --git a/mannschaft/migrations/__init__.py b/mannschaft/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/mannschaft/models.py b/mannschaft/models.py
new file mode 100644 (file)
index 0000000..b66b02e
--- /dev/null
@@ -0,0 +1,88 @@
+from django.db import models
+from django.contrib.auth.models import User
+
+# Create your models here.
+
+
+class Player(models.Model):
+    name = models.CharField(max_length=50)
+    firstname = models.CharField(max_length=50)
+    birthdate = models.DateField(blank=True, null=True)
+    dsvid = models.IntegerField(blank=True, null=True)
+    user = models.OneToOneField(User, null=True, on_delete=models.SET_NULL)
+
+    def __str__(self):
+        return self.name + ', ' + self.firstname
+    # ForeignKey(User, null=True, on_delete=models.SET_NULL)
+
+
+class Team(models.Model):
+    name = models.CharField(max_length=50)
+    min_age = models.IntegerField(default=0, blank=True, null=True)
+    max_age = models.IntegerField(default=999, blank=True, null=True)
+    players = models.ManyToManyField(Player, blank=True)
+    trainers = models.ManyToManyField(Player,
+                                      related_name='trainers', blank=True)
+
+    def __str__(self):
+        return self.name
+
+
+class Location(models.Model):
+    name = models.CharField(max_length=50)
+    street = models.CharField(max_length=100, blank=True, null=True)
+    zip = models.IntegerField(blank=True, null=True)
+    city = models.CharField(max_length=100, blank=True, null=True)
+    additional = models.CharField(max_length=100, blank=True, null=True)
+
+    def __str__(self):
+        return self.name
+
+
+class Event(models.Model):
+    begin = models.DateTimeField()
+    end = models.DateTimeField()
+    location = models.ForeignKey(Location, on_delete=models.CASCADE,
+                                 blank=True, null=True)
+    team = models.ForeignKey(Team, on_delete=models.CASCADE)
+    tasks = models.ManyToManyField(Player, through='Task', blank=True)
+    state = models.ManyToManyField(Player,
+                                   through='PlayerState',
+                                   related_name='event_player_state',
+                                   blank=True)
+    optional = models.TextField(blank=True, null=True)
+
+
+class Task(models.Model):
+    player = models.ForeignKey(Player, on_delete=models.CASCADE)
+    event = models.ForeignKey(Event, on_delete=models.CASCADE)
+    task = models.TextField()
+
+
+class Game(Event):
+    home = models.BooleanField()
+    opponent = models.CharField(max_length=50)
+    score_team = models.IntegerField(blank=True, null=True)
+    score_opponent = models.IntegerField(blank=True, null=True)
+
+    def __str__(self):
+        if self.home:
+            return self.team + ' - ' + self.opponent
+        else:
+            return self.opponent + ' - ' + self.team
+
+
+class Training(Event):
+    pass
+
+
+class PlayerState(models.Model):
+    ANSWERS = (
+        ('y', 'Ja'),
+        ('n', 'Nein'),
+        ('p', 'Vielleicht'),
+    )
+    player = models.ForeignKey(Player, on_delete=models.CASCADE)
+    event = models.ForeignKey(Event, on_delete=models.CASCADE)
+    state = models.CharField(max_length=1, choices=ANSWERS)
+    reason = models.CharField(max_length=180, blank=True, null=True)
diff --git a/mannschaft/tests.py b/mannschaft/tests.py
new file mode 100644 (file)
index 0000000..7ce503c
--- /dev/null
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/mannschaft/urls.py b/mannschaft/urls.py
new file mode 100644 (file)
index 0000000..88a9cac
--- /dev/null
@@ -0,0 +1,7 @@
+from django.urls import path
+
+from . import views
+
+urlpatterns = [
+    path('', views.index, name='index'),
+]
diff --git a/mannschaft/views.py b/mannschaft/views.py
new file mode 100644 (file)
index 0000000..68f28bd
--- /dev/null
@@ -0,0 +1,5 @@
+from django.shortcuts import render
+from django.http import HttpResponse
+
+def index(request):
+    return HttpResponse("Mannschaftsverwaltung")