Add database initialization

This commit is contained in:
Andreas Frisch 2020-03-27 17:40:09 +01:00
parent b9d3326560
commit 5b377e5b19
4 changed files with 53 additions and 4 deletions

View file

@ -0,0 +1,26 @@
# Generated by Django 2.0 on 2017-12-06 19:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
# ('members'),
]
operations = [
migrations.CreateModel(
name='SchaffenProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('membership_type', models.CharField(max_length=100)),
('is_keyholder', models.BooleanField(default=False)),
('has_physical_key', models.BooleanField(default=False)),
('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='profile_schaffen', to='members.Member')),
],
),
]

View file

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-13 13:30
from __future__ import unicode_literals
import annoying.fields
from django.db import migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('byro_schaffenburg', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='schaffenprofile',
name='member',
field=annoying.fields.AutoOneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile_shack', to='members.Member'),
),
]

View file

View file

@ -1,5 +1,6 @@
from annoying.fields import AutoOneToOneField from annoying.fields import AutoOneToOneField
from django.db import models from django.db import models
from byro.common.models.choices import Choices
class MembershipTypes(Choices): class MembershipTypes(Choices):
FULL = "Vollmitglied" FULL = "Vollmitglied"
@ -9,19 +10,19 @@ class SchaffenProfile(models.Model):
member = AutoOneToOneField( member = AutoOneToOneField(
to='members.Member', to='members.Member',
on_delete=models.CASCADE, on_delete=models.CASCADE,
related_name='profile_schaffenburg', related_name='profile_schaffen',
) )
membership_type = models.CharField( membership_type = models.CharField(
max_length=MembershipTypes.max_length, max_length=MembershipTypes.max_length,
verbose_name=_("Art der Mitgliedschaft"), verbose_name=("Art der Mitgliedschaft"),
choices=MembershipTypes.choices, choices=MembershipTypes.choices,
default=MembershipTypes.FULL, default=MembershipTypes.FULL,
) )
is_keyholder = models.BooleanField( is_keyholder = models.BooleanField(
default=False, default=False,
verbose_name=_("Ist schließberechtigt"), verbose_name=("Ist schließberechtigt"),
) )
has_physical_key = models.BooleanField( has_physical_key = models.BooleanField(
default=False, default=False,
verbose_name=_("Besitzt physischen Schlüssel"), verbose_name=("Besitzt physischen Schlüssel"),
) )