# Generated by Django 3.1.7 on 2021-04-07 09:44

from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomUser',
            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')),
                ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, 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')),
                ('is_mp', models.BooleanField(default=False)),
                ('is_constituent', models.BooleanField(default=False)),
                ('is_security_person', models.BooleanField(default=False)),
                ('is_medical_center', models.BooleanField(default=False)),
                ('is_assembly_man', models.BooleanField(default=False)),
                ('full_name', models.CharField(blank=True, max_length=250, null=True)),
                ('email', models.EmailField(max_length=254)),
                ('contact', models.CharField(default='', max_length=16)),
                ('date_of_birth', models.DateField(blank=True, null=True)),
                ('system_id_for_user', models.CharField(blank=True, max_length=15, null=True)),
                ('phone_verified', models.BooleanField(default=False)),
                ('profile_picture', models.ImageField(blank=True, default='default.jpg', null=True, upload_to='user_profile_pics/')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Constituency',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name_plural': 'Constituencies',
            },
        ),
        migrations.CreateModel(
            name='Country',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
            options={
                'verbose_name_plural': 'Countries',
            },
        ),
        migrations.CreateModel(
            name='OTPCode',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code_for', models.CharField(max_length=100)),
                ('code', models.CharField(max_length=7)),
            ],
        ),
        migrations.CreateModel(
            name='MpProfile',
            fields=[
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='users.customuser')),
                ('mp_id', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Town',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('country', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='towns', to='users.constituency')),
            ],
            options={
                'verbose_name_plural': 'Towns',
            },
        ),
        migrations.CreateModel(
            name='Region',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('country', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='regions', to='users.country')),
            ],
        ),
        migrations.CreateModel(
            name='Constituent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('voters_id', models.CharField(max_length=50)),
                ('town', models.CharField(max_length=100)),
                ('is_subadmin', models.BooleanField(default=False)),
                ('subadmin_for', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='sub_admins', to=settings.AUTH_USER_MODEL)),
                ('town_main', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.town')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='more_info', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='constituency',
            name='country',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='constituencies', to='users.region'),
        ),
        migrations.CreateModel(
            name='Area',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('country', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='areas', to='users.town')),
            ],
            options={
                'verbose_name_plural': 'Areas',
            },
        ),
        migrations.AddField(
            model_name='customuser',
            name='active_constituency',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.constituency'),
        ),
        migrations.AddField(
            model_name='customuser',
            name='constituency',
            field=models.ManyToManyField(related_name='members', to='users.Constituency'),
        ),
        migrations.AddField(
            model_name='customuser',
            name='country',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='members', to='users.country'),
        ),
        migrations.AddField(
            model_name='customuser',
            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='customuser',
            name='region',
            field=models.ManyToManyField(blank=True, null=True, related_name='members', to='users.Region'),
        ),
        migrations.AddField(
            model_name='customuser',
            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'),
        ),
        migrations.CreateModel(
            name='SubAdminPermission',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('can_post_projects', models.BooleanField(default=True)),
                ('can_read_requests', models.BooleanField(default=True)),
                ('can_send_emails', models.BooleanField(default=True)),
                ('sub_admin', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='permissions', to='users.constituent')),
                ('sub_admin_for', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='users.mpprofile')),
            ],
        ),
    ]
