--- /dev/null
+[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
--- /dev/null
+[Project]
+CreatedFrom=
+Manager=KDevCustomBuildSystem
+Name=Mannschaftsverwaltung
--- /dev/null
+"""
+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/'
--- /dev/null
+"""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),
+]
--- /dev/null
+"""
+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()
--- /dev/null
+#!/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)
--- /dev/null
+from django.contrib import admin
+
+from .models import Team, Location
+
+admin.site.register(Team)
+admin.site.register(Location)
--- /dev/null
+from django.apps import AppConfig
+
+
+class MannschaftConfig(AppConfig):
+ name = 'mannschaft'
--- /dev/null
+# 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'),
+ ),
+ ]
--- /dev/null
+# 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),
+ ),
+ ]
--- /dev/null
+# 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),
+ ),
+ ]
--- /dev/null
+# 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),
+ ),
+ ]
--- /dev/null
+# 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'),
+ ),
+ ]
--- /dev/null
+# 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'),
+ ),
+ ]
--- /dev/null
+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)
--- /dev/null
+from django.test import TestCase
+
+# Create your tests here.
--- /dev/null
+from django.urls import path
+
+from . import views
+
+urlpatterns = [
+ path('', views.index, name='index'),
+]
--- /dev/null
+from django.shortcuts import render
+from django.http import HttpResponse
+
+def index(request):
+ return HttpResponse("Mannschaftsverwaltung")