# Generated by Django 2.1.12 on 2019-10-05 14:07

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import image_cropping.fields
import langerak_gkv.users.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [("auth", "0009_alter_user_last_name_max_length")]

    operations = [
        migrations.CreateModel(
            name="User",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("password", models.CharField(max_length=128, verbose_name="password")),
                (
                    "last_login",
                    models.DateTimeField(
                        blank=True, null=True, verbose_name="last login"
                    ),
                ),
                (
                    "is_superuser",
                    models.BooleanField(
                        default=False,
                        help_text="Designates that this user has all permissions without explicitly assigning them.",
                        verbose_name="superuser status",
                    ),
                ),
                (
                    "email",
                    models.EmailField(
                        max_length=254, unique=True, verbose_name="email address"
                    ),
                ),
                (
                    "username",
                    models.CharField(
                        blank=True, max_length=100, verbose_name="username"
                    ),
                ),
                (
                    "first_name",
                    models.CharField(
                        blank=True, max_length=50, verbose_name="first name"
                    ),
                ),
                (
                    "last_name",
                    models.CharField(
                        blank=True, max_length=50, verbose_name="last name"
                    ),
                ),
                (
                    "is_staff",
                    models.BooleanField(
                        default=False,
                        help_text="Designates whether the user can log into this admin site.",
                        verbose_name="staff status",
                    ),
                ),
                (
                    "is_active",
                    models.BooleanField(
                        default=True,
                        help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
                        verbose_name="active",
                    ),
                ),
                (
                    "date_joined",
                    models.DateTimeField(
                        default=django.utils.timezone.now, verbose_name="date joined"
                    ),
                ),
                (
                    "sex",
                    models.CharField(
                        blank=True,
                        choices=[("male", "male"), ("female", "female")],
                        default="male",
                        max_length=10,
                        verbose_name="sex",
                    ),
                ),
                (
                    "address",
                    models.CharField(
                        blank=True,
                        help_text="Street name and number.",
                        max_length=255,
                        verbose_name="street",
                    ),
                ),
                (
                    "postal_code",
                    models.CharField(
                        blank=True, max_length=10, verbose_name="postal code"
                    ),
                ),
                (
                    "city",
                    models.CharField(blank=True, max_length=100, verbose_name="city"),
                ),
                (
                    "phone",
                    models.CharField(
                        blank=True,
                        help_text="Home phone number",
                        max_length=20,
                        verbose_name="phone",
                    ),
                ),
                (
                    "mobile",
                    models.CharField(
                        blank=True,
                        help_text="Mobile phone number",
                        max_length=20,
                        verbose_name="mobile phone number",
                    ),
                ),
                (
                    "birthdate",
                    models.DateField(blank=True, null=True, verbose_name="birth_date"),
                ),
                (
                    "picture",
                    models.ImageField(
                        blank=True,
                        help_text="Profile picture",
                        null=True,
                        upload_to=langerak_gkv.users.models.get_image_path,
                        verbose_name="picture",
                    ),
                ),
                (
                    "cropping",
                    image_cropping.fields.ImageRatioField(
                        "picture",
                        "400x400",
                        adapt_rotation=False,
                        allow_fullsize=False,
                        free_crop=False,
                        help_text=None,
                        hide_image_field=False,
                        size_warning=True,
                        verbose_name="cropping",
                    ),
                ),
                (
                    "about_me",
                    models.TextField(blank=True, help_text="Short 'about me' text"),
                ),
                (
                    "member_type",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("baptised", "baptised member"),
                            ("practicing", "practicing member"),
                            ("guest", "guest member"),
                        ],
                        max_length=20,
                        verbose_name="member type",
                    ),
                ),
                (
                    "external_code",
                    models.CharField(
                        blank=True,
                        max_length=10,
                        null=True,
                        verbose_name="external code",
                    ),
                ),
                ("exclude_in_queries", models.BooleanField(default=False)),
            ],
            options={"verbose_name": "user", "verbose_name_plural": "users"},
        ),
        migrations.CreateModel(
            name="District",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=255, verbose_name="name")),
            ],
            options={"verbose_name": "district", "verbose_name_plural": "districts"},
        ),
        migrations.CreateModel(
            name="DistrictFunction",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=255, verbose_name="name")),
                (
                    "description",
                    models.CharField(
                        blank=True,
                        help_text="Describe what someone with this function does.",
                        max_length=255,
                        verbose_name="description",
                    ),
                ),
            ],
            options={
                "verbose_name": "district function",
                "verbose_name_plural": "district functions",
            },
        ),
        migrations.CreateModel(
            name="Family",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="Last name of the householder.",
                        max_length=255,
                        verbose_name="name",
                    ),
                ),
                (
                    "address",
                    models.CharField(
                        blank=True,
                        help_text="Street name and number.",
                        max_length=255,
                        verbose_name="street",
                    ),
                ),
                (
                    "postal_code",
                    models.CharField(max_length=10, verbose_name="postal code"),
                ),
                (
                    "city",
                    models.CharField(blank=True, max_length=100, verbose_name="city"),
                ),
            ],
            options={"verbose_name": "family", "verbose_name_plural": "families"},
        ),
        migrations.CreateModel(
            name="RelationType",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "name_male",
                    models.CharField(max_length=100, verbose_name="name (male)"),
                ),
                (
                    "name_female",
                    models.CharField(max_length=100, verbose_name="name (female)"),
                ),
                (
                    "reverse_name_male",
                    models.CharField(
                        max_length=100, verbose_name="reverse name (male)"
                    ),
                ),
                (
                    "reverse_name_female",
                    models.CharField(
                        max_length=100, verbose_name="reverse name (female)"
                    ),
                ),
                (
                    "is_partner",
                    models.BooleanField(default=False, verbose_name="is partner?"),
                ),
                (
                    "is_child_parent",
                    models.BooleanField(default=False, verbose_name="is child/parent?"),
                ),
                (
                    "reverse",
                    models.ForeignKey(
                        help_text="Reverse direction of the relation",
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="users.RelationType",
                    ),
                ),
            ],
            options={
                "verbose_name": "relation type",
                "verbose_name_plural": "relation types",
            },
        ),
        migrations.CreateModel(
            name="UserRelation",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "relation_type",
                    models.ForeignKey(
                        help_text="User 2 is `relation type` of user 1.",
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="users.RelationType",
                    ),
                ),
                (
                    "user1",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="related_users",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "user2",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="reverse_related_users",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "user relation",
                "verbose_name_plural": "user relations",
            },
        ),
        migrations.AlterUniqueTogether(
            name="family", unique_together={("address", "postal_code")}
        ),
        migrations.AddField(
            model_name="user",
            name="district",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="users.District",
                verbose_name="district",
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="district_function",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="users.DistrictFunction",
                verbose_name="district function",
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="family",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to="users.Family",
                verbose_name="family",
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="groups",
            field=models.ManyToManyField(
                blank=True,
                help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
                related_name="user_set",
                related_query_name="user",
                to="auth.Group",
                verbose_name="groups",
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="relations",
            field=models.ManyToManyField(
                blank=True, through="users.UserRelation", to=settings.AUTH_USER_MODEL
            ),
        ),
        migrations.AddField(
            model_name="user",
            name="user_permissions",
            field=models.ManyToManyField(
                blank=True,
                help_text="Specific permissions for this user.",
                related_name="user_set",
                related_query_name="user",
                to="auth.Permission",
                verbose_name="user permissions",
            ),
        ),
    ]
