# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-13 12:36
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import smart_selects.db_fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Player',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, null=True)),
                ('surename', models.CharField(max_length=200, null=True)),
                ('jersey', models.IntegerField(blank=True, null=True)),
                ('birth_date', models.DateField(null=True)),
                ('position', models.CharField(max_length=50, null=True)),
                ('weight', models.IntegerField(default=0, help_text='Insert weight in kg', null=True)),
                ('height', models.IntegerField(default=0, help_text='Insert height in cm', null=True)),
                ('image', models.ImageField(blank=True, null=True, upload_to='uploads/teams/%Y/%m/%d/players/')),
            ],
        ),
        migrations.CreateModel(
            name='PlayerCustomFields',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('custom_field_order', models.IntegerField(blank=True, null=True)),
                ('name', models.CharField(max_length=200, null=True)),
                ('player', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='league.Player')),
            ],
        ),
        migrations.CreateModel(
            name='Schedule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('week', models.IntegerField(default=1)),
                ('date', models.DateTimeField(default=django.utils.timezone.now)),
                ('home_team_score', models.IntegerField(blank=True, null=True)),
                ('away_team_score', models.IntegerField(blank=True, null=True)),
                ('city', models.CharField(blank=True, max_length=200, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Season',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('league', models.CharField(max_length=200, null=True)),
                ('slug', models.SlugField(null=True, unique=True)),
                ('standings_order', models.IntegerField(choices=[(0, 'Points, Wins, Lost, Score Lost'), (1, 'Points, Score, Score Lost')], default=0)),
                ('win_points', models.IntegerField(default=0, null=True)),
                ('lost_points', models.IntegerField(default=0, null=True)),
                ('draw_points', models.IntegerField(default=0, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Standings',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('roster_image', models.ImageField(blank=True, null=True, upload_to='uploads/teams/%Y/%m/%d/rosters/')),
                ('position', models.IntegerField(blank=True, default=1, null=True)),
                ('matches', models.IntegerField(blank=True, default=0, null=True)),
                ('win', models.IntegerField(default=0, null=True)),
                ('lost', models.IntegerField(default=0, null=True)),
                ('draws', models.IntegerField(default=0, null=True)),
                ('score', models.IntegerField(default=0, null=True)),
                ('score_lost', models.IntegerField(default=0, null=True)),
                ('points', models.IntegerField(default=0, null=True)),
                ('season', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='league.Season')),
            ],
            options={
                'ordering': ('-points', 'score_lost', '-win', 'lost'),
            },
        ),
        migrations.CreateModel(
            name='Team',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('short_name', models.CharField(max_length=50)),
                ('slug', models.SlugField(null=True, unique=True)),
                ('logo', models.ImageField(blank=True, null=True, upload_to='uploads/teams/%Y/%m/%d/')),
                ('my_team', models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], default=0)),
            ],
        ),
        migrations.AddField(
            model_name='standings',
            name='team',
            field=smart_selects.db_fields.ChainedForeignKey(chained_field='season', chained_model_field='teams', on_delete=django.db.models.deletion.CASCADE, related_name='team', to='league.Team'),
        ),
        migrations.AddField(
            model_name='season',
            name='teams',
            field=models.ManyToManyField(blank=True, null=True, related_name='teams', to='league.Team'),
        ),
        migrations.AddField(
            model_name='schedule',
            name='away_team',
            field=smart_selects.db_fields.ChainedForeignKey(chained_field='season', chained_model_field='teams', on_delete=django.db.models.deletion.CASCADE, related_name='away_team', to='league.Team'),
        ),
        migrations.AddField(
            model_name='schedule',
            name='home_team',
            field=smart_selects.db_fields.ChainedForeignKey(chained_field='season', chained_model_field='teams', on_delete=django.db.models.deletion.CASCADE, related_name='home_team', to='league.Team'),
        ),
        migrations.AddField(
            model_name='schedule',
            name='season',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='league.Season'),
        ),
        migrations.AddField(
            model_name='player',
            name='season',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='league.Season'),
        ),
        migrations.AddField(
            model_name='player',
            name='team',
            field=smart_selects.db_fields.ChainedForeignKey(chained_field='season', chained_model_field='teams', on_delete=django.db.models.deletion.CASCADE, related_name='player_team', to='league.Team'),
        ),
        migrations.AlterUniqueTogether(
            name='standings',
            unique_together=set([('season', 'team')]),
        ),
    ]
