# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-04 07:39
from __future__ import unicode_literals

import ckeditor.fields
from decimal import Decimal
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
import djmoney.models.fields
import mptt.fields
import tagging.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0008_alter_user_username_max_length'),
        ('contenttypes', '0002_remove_content_type_name'),
        ('econ', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Brand',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ('modified', models.DateTimeField(default=django.utils.timezone.now)),
                ('name', models.CharField(max_length=100)),
                ('sym', models.CharField(max_length=20)),
                ('logo', models.ImageField(blank=True, null=True, upload_to=b'media/%Y/%m/%d/%H/%M/%S/')),
                ('tags', tagging.fields.TagField(blank=True, max_length=255)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Cagetory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ('modified', models.DateTimeField(default=django.utils.timezone.now)),
                ('name', models.CharField(max_length=50)),
                ('allow_choose', models.BooleanField(default=True)),
                ('tags', tagging.fields.TagField(blank=True, max_length=255)),
                ('optiontype', models.IntegerField(choices=[(1, b'Inherit'), (2, b'Option by specify'), (3, b'Option by generic')], default=1)),
                ('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)),
                ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='econ.Cagetory')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
                ('bio', models.TextField(blank=True, max_length=500)),
                ('address', models.TextField(blank=True, max_length=500)),
                ('birthday', models.DateField(blank=True, null=True)),
                ('gender', models.CharField(choices=[(b'U', b'Unknow'), (b'M', b'Male'), (b'F', b'Female')], default=b'U', max_length=1)),
                ('avatar', models.ImageField(blank=True, null=True, upload_to=b'media/%Y/%m/%d/%H/%M/%S/')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
            },
            bases=('auth.user',),
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ('modified', models.DateTimeField(default=django.utils.timezone.now)),
                ('name', models.CharField(max_length=100)),
                ('tags', tagging.fields.TagField(blank=True, max_length=255)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ProductImage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(blank=True, null=True, upload_to=b'media/%Y/%m/%d/%H/%M/%S/')),
                ('link', models.CharField(blank=True, max_length=300, null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ProductOption',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('price_currency', djmoney.models.fields.CurrencyField(choices=[(b'USD', b'Dolars'), (b'EUR', 'Euro'), (b'VND', b'Vietnam Dong')], default=b'USD', editable=False, max_length=3)),
                ('price', djmoney.models.fields.MoneyField(decimal_places=2, default=Decimal('0.0'), default_currency=b'USD', max_digits=10)),
                ('quatity', models.IntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='ProductOptionImage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(blank=True, null=True, upload_to=b'media/%Y/%m/%d/%H/%M/%S/')),
                ('link', models.CharField(blank=True, max_length=300, null=True)),
                ('productoption', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='econ.ProductOption')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ProductOptionSpecDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('desc', models.CharField(blank=True, max_length=100, null=True)),
                ('prod_option', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='econ.ProductOption')),
            ],
        ),
        migrations.CreateModel(
            name='ProductPromotion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('promotiontype', models.CharField(choices=[(b'M', b'Minus'), (b'P', b'Percentage'), (b'O', b'Offer')], default=b'P', max_length=1)),
                ('value', models.FloatField()),
                ('start', models.DateTimeField(null=True)),
                ('end', models.DateTimeField(null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Slug',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(unique=True)),
                ('object_id', models.PositiveIntegerField()),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
        ),
        migrations.CreateModel(
            name='Specific',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('specific_name', models.CharField(max_length=50)),
                ('specific_of', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='econ.Cagetory')),
            ],
        ),
        migrations.CreateModel(
            name='SpecificDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('detail_value', models.CharField(blank=True, max_length=50, null=True)),
                ('detail_field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='econ.Specific')),
            ],
        ),
        migrations.CreateModel(
            name='ProductInfo',
            fields=[
                ('product', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='econ.Product')),
                ('info', ckeditor.fields.RichTextField(blank=True, null=True)),
            ],
        ),
        migrations.AddField(
            model_name='productpromotion',
            name='apply_to',
            field=models.ManyToManyField(blank=True, null=True, to='econ.Product'),
        ),
        migrations.AddField(
            model_name='productoptionspecdetail',
            name='spec',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='econ.SpecificDetail'),
        ),
        migrations.AddField(
            model_name='productoption',
            name='prod',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='econ.Product'),
        ),
        migrations.AddField(
            model_name='productimage',
            name='product',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='econ.Product'),
        ),
        migrations.AddField(
            model_name='product',
            name='branch',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='econ.Brand'),
        ),
        migrations.AddField(
            model_name='product',
            name='cagetory',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='econ.Cagetory'),
        ),
        migrations.AddField(
            model_name='product',
            name='spec',
            field=models.ManyToManyField(to='econ.Specific'),
        ),
        migrations.AlterUniqueTogether(
            name='specificdetail',
            unique_together=set([('detail_field', 'detail_value')]),
        ),
        migrations.AlterUniqueTogether(
            name='specific',
            unique_together=set([('specific_name', 'specific_of')]),
        ),
        migrations.AlterUniqueTogether(
            name='productoptionspecdetail',
            unique_together=set([('spec', 'prod_option')]),
        ),
    ]
