# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-24 16:13
from __future__ import unicode_literals

import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Cars',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('model_name', models.CharField(max_length=100)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Comments',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=150)),
                ('email', models.EmailField(max_length=150)),
                ('comment', models.TextField(max_length=255)),
                ('is_approved', models.BooleanField(default=True)),
                ('submit_date', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Contacts',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.CharField(max_length=40)),
                ('num_type', models.CharField(choices=[('M', 'Mobile'), ('T', 'Telephone'), ('F', 'Fax')], default='M', max_length=10)),
            ],
        ),
        migrations.CreateModel(
            name='Crafts',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('craft', models.CharField(max_length=200)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Governorates',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('governorate', models.CharField(max_length=150)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Images',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(upload_to='media/uploads')),
            ],
        ),
        migrations.CreateModel(
            name='Rates',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ip', models.GenericIPAddressField()),
                ('rate', models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(5), django.core.validators.MinValueValidator(0)])),
                ('submit_date', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Specializations',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('specialization', models.CharField(max_length=100)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Subscribe',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('email', models.EmailField(max_length=150)),
                ('is_active', models.BooleanField(default=True)),
                ('submit_date', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Workshops',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=250)),
                ('owner', models.CharField(max_length=250)),
                ('address', models.CharField(max_length=250)),
                ('location', models.CharField(max_length=100)),
                ('is_visible', models.BooleanField(default=True)),
                ('notes', models.TextField(blank=True, max_length=255)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('cars', models.ManyToManyField(to='main.Cars')),
                ('crafts', smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='specializations', chained_model_field='specializations', on_delete=django.db.models.deletion.CASCADE, to='main.Crafts')),
                ('governorate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Governorates')),
                ('specializations', models.ManyToManyField(to='main.Specializations')),
            ],
        ),
        migrations.CreateModel(
            name='Zones',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('zone', models.CharField(max_length=150)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('governorate', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Governorates')),
            ],
        ),
        migrations.AddField(
            model_name='workshops',
            name='zone',
            field=smart_selects.db_fields.ChainedForeignKey(auto_choose=True, chained_field='governorate', chained_model_field='governorate', on_delete=django.db.models.deletion.CASCADE, to='main.Zones'),
        ),
        migrations.AddField(
            model_name='rates',
            name='workshop',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Workshops'),
        ),
        migrations.AddField(
            model_name='images',
            name='workshop',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='main.Workshops'),
        ),
        migrations.AddField(
            model_name='crafts',
            name='specialization',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Specializations'),
        ),
        migrations.AddField(
            model_name='contacts',
            name='workshop',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='contacts', to='main.Workshops'),
        ),
        migrations.AddField(
            model_name='comments',
            name='workshop',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='main.Workshops'),
        ),
    ]
