# Generated by Django 3.0.7 on 2021-08-26 07:13

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=200)),
                ('slug', models.SlugField(max_length=200, unique=True)),
            ],
            options={
                'verbose_name': 'دسته بندی',
                'verbose_name_plural': 'دسته بندی ها',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Coupon',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('coupon_type', models.CharField(choices=[('c', 'نقدی'), ('p', 'درصدی')], max_length=1)),
                ('created_date', models.DateTimeField(auto_now=True)),
                ('expired_date', models.DateTimeField()),
                ('cash_amount', models.IntegerField(blank=True, null=True)),
                ('percent_amount', models.FloatField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(1)])),
                ('is_active', models.BooleanField(default=True)),
            ],
            options={
                'verbose_name': ' کوپن',
                'verbose_name_plural': 'کوپن ها',
                'ordering': ['created_date'],
            },
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('created_date', models.DateField(auto_now_add=True)),
                ('author', models.CharField(max_length=100)),
                ('price', models.BigIntegerField()),
                ('inventory', models.IntegerField()),
                ('cover', models.ImageField(blank=True, upload_to='media/')),
                ('description', models.TextField(blank=True)),
                ('publisher', models.CharField(blank=True, max_length=200, null=True)),
                ('category', models.ManyToManyField(related_name='book', to='products.Category')),
                ('coupon', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='coupon', to='products.Coupon')),
            ],
            options={
                'verbose_name': 'کتاب',
                'verbose_name_plural': ' کتاب ها',
                'ordering': ('-created_date',),
            },
        ),
    ]
