# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-26 18:43
from __future__ import unicode_literals

import autoslug.fields
from django.conf import settings
import django.contrib.auth.models
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_countries.fields
import easy_thumbnails.fields
import mptt.fields
import velo.core.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('sitetree', '__first__'),
        ('auth', '0008_alter_user_username_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='parole')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='pēdējoreiz pieslēdzies')),
                ('is_superuser', models.BooleanField(default=False, help_text='Lietotājam ir visas tiesības arī bez to atsevišķas piešķiršanas.', verbose_name='superlietotāja statuss')),
                ('first_name', models.CharField(blank=True, max_length=30, verbose_name='Vārds')),
                ('last_name', models.CharField(blank=True, max_length=30, verbose_name='Uzvārds')),
                ('email', models.EmailField(max_length=254, unique=True, verbose_name='E-pasta adrese')),
                ('country', django_countries.fields.CountryField(blank=True, default='LV', max_length=2, null=True, verbose_name='Valsts')),
                ('ssn', models.CharField(blank=True, max_length=12, verbose_name='Personas kods')),
                ('birthday', models.DateField(blank=True, null=True, verbose_name='Dzimšanas diena')),
                ('phone_number', models.CharField(blank=True, max_length=60, verbose_name='Telefona numurs')),
                ('send_email', models.BooleanField(default=True, verbose_name='Sūtīt e-pasta jaunumus')),
                ('full_name', models.CharField(blank=True, max_length=60, verbose_name='Pilns vārds')),
                ('is_staff', models.BooleanField(default=False, help_text='Norāda vai lietotājs var pieslēgties administratora panelim.', verbose_name='Darbinieka statuss')),
                ('is_active', models.BooleanField(default=True, help_text='Norāda vai lietotājs ir aktīvs.', verbose_name='aktīvs')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='datums, kad pievienojās')),
                ('image', easy_thumbnails.fields.ThumbnailerImageField(blank=True, upload_to=velo.core.models._get_profile_upload_path, verbose_name='Profila bilde')),
                ('description', models.TextField(blank=True, verbose_name='Apraksts')),
            ],
            options={
                'verbose_name': 'lietotājs',
                'verbose_name_plural': 'lietotāji',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Choices',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('kind', models.SmallIntegerField(choices=[(10, 'Velo Zīmols'), (20, 'Nodarbošanās'), (30, 'Kur uzzināja'), (40, 'Pilsēta')])),
                ('is_active', models.BooleanField(default=True)),
                ('title', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Competition',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('name_lv', models.CharField(max_length=100, null=True)),
                ('name_en', models.CharField(max_length=100, null=True)),
                ('name_ru', models.CharField(max_length=100, null=True)),
                ('alias', autoslug.fields.AutoSlugField(editable=False, populate_from='name')),
                ('short_name', models.CharField(blank=True, max_length=50)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('place_name', models.CharField(blank=True, max_length=50)),
                ('competition_date', models.DateField(blank=True, null=True)),
                ('competition_date_till', models.DateField(blank=True, null=True)),
                ('kind', models.SmallIntegerField(choices=[(0, 'Velo'), (1, 'Distanču slēpošana')], default=0)),
                ('complex_payment_enddate', models.DateTimeField(blank=True, null=True)),
                ('complex_payment_hideon', models.DateTimeField(blank=True, null=True)),
                ('complex_discount', models.SmallIntegerField(default=0)),
                ('bill_series', models.CharField(blank=True, default='B', max_length=20)),
                ('payment_channel', models.CharField(default='LKDF', max_length=20)),
                ('processing_class', models.CharField(blank=True, max_length=100)),
                ('legacy_id', models.IntegerField(blank=True, null=True)),
                ('is_in_menu', models.BooleanField(default=False)),
                ('skin', models.CharField(blank=True, max_length=50)),
                ('logo', easy_thumbnails.fields.ThumbnailerImageField(blank=True, upload_to=velo.core.models._get_logo_upload_path)),
                ('logo_svg', models.FileField(blank=True, upload_to=velo.core.models._get_logo_upload_path)),
                ('apply_image', easy_thumbnails.fields.ThumbnailerImageField(blank=True, upload_to=velo.core.models._get_logo_upload_path)),
                ('params', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
                ('sms_text', models.CharField(blank=True, max_length=255)),
                ('map_url', models.URLField(blank=True)),
                ('frontpage_ordering', models.PositiveSmallIntegerField(default=0)),
                ('description', models.TextField(blank=True)),
                ('description_lv', models.TextField(blank=True, null=True)),
                ('description_en', models.TextField(blank=True, null=True)),
                ('description_ru', models.TextField(blank=True, null=True)),
                ('use_official_team_results', models.BooleanField(default=True)),
                ('lft', models.PositiveIntegerField(db_index=True, editable=False)),
                ('rght', models.PositiveIntegerField(db_index=True, editable=False)),
                ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
                ('level', models.PositiveIntegerField(db_index=True, editable=False)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='created_competition_set', to=settings.AUTH_USER_MODEL)),
                ('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='modified_competition_set', to=settings.AUTH_USER_MODEL)),
                ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='core.Competition')),
                ('sitetree', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='sitetree.TreeItem')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CustomSlug',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=60)),
                ('last_name', models.CharField(max_length=60)),
                ('birthday', models.DateField()),
                ('slug', models.SlugField(blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='Distance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Izveidots')),
                ('modified', models.DateTimeField(auto_now=True, verbose_name='Labots')),
                ('name', models.CharField(max_length=100)),
                ('name_lv', models.CharField(max_length=100, null=True)),
                ('name_en', models.CharField(max_length=100, null=True)),
                ('name_ru', models.CharField(max_length=100, null=True)),
                ('distance_text', models.CharField(blank=True, max_length=50)),
                ('distance_m', models.IntegerField(blank=True, help_text='Distance in meters', null=True)),
                ('can_have_teams', models.BooleanField(default=True)),
                ('have_results', models.BooleanField(default=True)),
                ('profile_price', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True)),
                ('kind', models.CharField(blank=True, max_length=2)),
                ('competition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Competition')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='created_distance_set', to=settings.AUTH_USER_MODEL)),
                ('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='modified_distance_set', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='FailedTask',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(blank=True, null=True)),
                ('name', models.CharField(max_length=125)),
                ('full_name', models.TextField()),
                ('args', models.TextField(blank=True, null=True)),
                ('kwargs', models.TextField(blank=True, null=True)),
                ('exception_class', models.TextField()),
                ('exception_msg', models.TextField()),
                ('traceback', models.TextField(blank=True, null=True)),
                ('celery_task_id', models.CharField(max_length=36)),
                ('failures', models.PositiveSmallIntegerField(default=1)),
            ],
            options={
                'ordering': ('-updated_at',),
            },
        ),
        migrations.CreateModel(
            name='Insurance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.SmallIntegerField(choices=[(0, 'Inactive'), (1, 'Active'), (-1, 'Deleted')], default=0)),
                ('title', models.CharField(max_length=100)),
                ('price', models.DecimalField(decimal_places=2, default=0.0, max_digits=20)),
                ('in_complex', models.BooleanField(default=True)),
                ('complex_discount', models.SmallIntegerField(default=0)),
                ('competition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Competition')),
            ],
            options={
                'ordering': ('competition', 'price'),
            },
        ),
        migrations.CreateModel(
            name='InsuranceCompany',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('term', models.TextField(blank=True)),
                ('term_lv', models.TextField(blank=True, null=True)),
                ('term_en', models.TextField(blank=True, null=True)),
                ('term_ru', models.TextField(blank=True, null=True)),
                ('terms_doc', models.FileField(blank=True, upload_to=velo.core.models._get_insurance_term_upload_path)),
            ],
        ),
        migrations.CreateModel(
            name='Log',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('object_id', models.PositiveIntegerField(blank=True, null=True)),
                ('action', models.CharField(blank=True, max_length=50)),
                ('message', models.CharField(blank=True, max_length=255)),
                ('params', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Map',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255)),
                ('image', easy_thumbnails.fields.ThumbnailerImageField(upload_to=velo.core.models._get_map_upload_path)),
                ('gpx', models.FileField(blank=True, null=True, upload_to=velo.core.models._get_gpx_upload_path)),
                ('ordering', models.IntegerField(default=0)),
                ('competition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Competition')),
            ],
            options={
                'ordering': ('competition', 'ordering'),
            },
        ),
        migrations.AddField(
            model_name='insurance',
            name='insurance_company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.InsuranceCompany'),
        ),
        migrations.AddField(
            model_name='user',
            name='bike_brand',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='core.Choices', verbose_name='Velo Zīmols'),
        ),
        migrations.AddField(
            model_name='user',
            name='city',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='core.Choices', verbose_name='Pilsēta'),
        ),
        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='grupas'),
        ),
        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='lietotāja tiesības'),
        ),
        migrations.AlterOrderWithRespectTo(
            name='distance',
            order_with_respect_to='competition',
        ),
    ]
