# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-14 14:49
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Circuit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30, unique=True, verbose_name='circuit')),
                ('city', models.CharField(blank=True, max_length=100, null=True)),
                ('country', django_countries.fields.CountryField(max_length=2)),
                ('opened_in', models.IntegerField()),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Competition',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30, unique=True, verbose_name='competition')),
                ('full_name', models.CharField(max_length=100, unique=True)),
                ('country', django_countries.fields.CountryField(blank=True, default=None, max_length=2, null=True)),
                ('slug', models.SlugField(blank=True, default=None, null=True)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Contender',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('competition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contenders', to='driver27.Competition')),
            ],
            options={
                'ordering': ['competition__name', 'driver__last_name', 'driver__first_name'],
            },
        ),
        migrations.CreateModel(
            name='Driver',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('last_name', models.CharField(max_length=50)),
                ('first_name', models.CharField(max_length=25)),
                ('year_of_birth', models.IntegerField()),
                ('country', django_countries.fields.CountryField(max_length=2)),
                ('competitions', models.ManyToManyField(related_name='drivers', through='driver27.Contender', to='driver27.Competition')),
            ],
            options={
                'ordering': ['last_name', 'first_name'],
            },
        ),
        migrations.CreateModel(
            name='GrandPrix',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30, unique=True, verbose_name='grand prix')),
                ('country', django_countries.fields.CountryField(blank=True, default=None, max_length=2, null=True)),
                ('first_held', models.IntegerField(blank=True, null=True)),
                ('competitions', models.ManyToManyField(default=None, related_name='grands_prix', to='driver27.Competition')),
                ('default_circuit', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='default_to_grands_prix', to='driver27.Circuit')),
            ],
            options={
                'ordering': ['name'],
                'verbose_name_plural': 'grands prix',
            },
        ),
        migrations.CreateModel(
            name='Race',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('round', models.IntegerField()),
                ('date', models.DateField(blank=True, default=None, null=True)),
                ('alter_punctuation', models.CharField(blank=True, choices=[('double', 'Double'), ('half', 'Half')], default=None, max_length=6, null=True)),
                ('circuit', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='races', to='driver27.Circuit')),
                ('grand_prix', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='races', to='driver27.GrandPrix')),
            ],
            options={
                'ordering': ['season', 'round'],
            },
        ),
        migrations.CreateModel(
            name='Result',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('qualifying', models.IntegerField(blank=True, default=None, null=True)),
                ('finish', models.IntegerField(blank=True, default=None, null=True)),
                ('fastest_lap', models.BooleanField(default=False)),
                ('retired', models.BooleanField(default=False)),
                ('wildcard', models.BooleanField(default=False)),
                ('comment', models.CharField(blank=True, default=None, max_length=250, null=True)),
                ('race', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='results', to='driver27.Race')),
            ],
            options={
                'ordering': ['race__season', 'race__round', 'finish', 'qualifying'],
            },
        ),
        migrations.CreateModel(
            name='Season',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year', models.IntegerField()),
                ('rounds', models.IntegerField(blank=True, default=None, null=True)),
                ('punctuation', models.CharField(default=None, max_length=20, null=True)),
                ('competition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='seasons', to='driver27.Competition')),
            ],
            options={
                'ordering': ['competition__name', 'year'],
            },
        ),
        migrations.CreateModel(
            name='Seat',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('current', models.BooleanField(default=False)),
                ('contender', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='seats', to='driver27.Contender')),
                ('seasons', models.ManyToManyField(blank=True, default=None, related_name='seats', to='driver27.Season')),
            ],
            options={
                'ordering': ['contender__driver__last_name', 'team'],
            },
        ),
        migrations.CreateModel(
            name='Team',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=75, unique=True, verbose_name='team')),
                ('full_name', models.CharField(max_length=200, unique=True)),
                ('country', django_countries.fields.CountryField(max_length=2)),
                ('competitions', models.ManyToManyField(related_name='teams', to='driver27.Competition')),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='TeamSeason',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sponsor_name', models.CharField(blank=True, default=None, max_length=75, null=True)),
                ('season', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='teams_season', to='driver27.Season')),
                ('team', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='seasons_team', to='driver27.Team')),
            ],
            options={
                'verbose_name': 'Team Season',
                'verbose_name_plural': 'Teams Season',
            },
        ),
        migrations.AddField(
            model_name='seat',
            name='team',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='seats', to='driver27.Team'),
        ),
        migrations.AddField(
            model_name='season',
            name='teams',
            field=models.ManyToManyField(related_name='seasons', through='driver27.TeamSeason', to='driver27.Team'),
        ),
        migrations.AddField(
            model_name='result',
            name='seat',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='results', to='driver27.Seat'),
        ),
        migrations.AddField(
            model_name='race',
            name='season',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='races', to='driver27.Season'),
        ),
        migrations.AddField(
            model_name='contender',
            name='driver',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='career', to='driver27.Driver'),
        ),
        migrations.AddField(
            model_name='contender',
            name='teams',
            field=models.ManyToManyField(related_name='contenders', through='driver27.Seat', to='driver27.Team'),
        ),
        migrations.AlterUniqueTogether(
            name='teamseason',
            unique_together=set([('season', 'team')]),
        ),
        migrations.AlterUniqueTogether(
            name='seat',
            unique_together=set([('team', 'contender')]),
        ),
        migrations.AlterUniqueTogether(
            name='season',
            unique_together=set([('year', 'competition')]),
        ),
        migrations.AlterUniqueTogether(
            name='result',
            unique_together=set([('race', 'seat'), ('race', 'qualifying'), ('race', 'finish')]),
        ),
        migrations.AlterUniqueTogether(
            name='race',
            unique_together=set([('season', 'round')]),
        ),
        migrations.AlterUniqueTogether(
            name='driver',
            unique_together=set([('last_name', 'first_name')]),
        ),
        migrations.AlterUniqueTogether(
            name='contender',
            unique_together=set([('driver', 'competition')]),
        ),
    ]
