# Generated by Django 3.0.1 on 2020-01-16 16:26

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=250, unique=True)),
            ],
            options={
                'verbose_name': 'Категория',
                'verbose_name_plural': 'Категории',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100, verbose_name='Название')),
                ('description', models.TextField(blank=True, max_length=500, verbose_name='Описание')),
                ('image', models.ImageField(blank=True, upload_to='static', verbose_name='Изображение')),
                ('price', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Цена')),
                ('slug', models.SlugField(max_length=250, unique=True)),
                ('in_stock', models.PositiveIntegerField(verbose_name='В наличии')),
                ('available', models.BooleanField(default=True, verbose_name='Доступно')),
                ('created_item', models.DateTimeField(auto_now_add=True)),
                ('updated_item', models.DateTimeField(auto_now=True)),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='products', to='coresite.Category', verbose_name='Категория')),
            ],
            options={
                'ordering': ['-title'],
                'index_together': {('id', 'slug')},
            },
        ),
        migrations.CreateModel(
            name='Reviews',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('author', models.CharField(max_length=50)),
                ('rate', models.PositiveIntegerField(default=5, validators=[django.core.validators.MaxValueValidator(5), django.core.validators.MinValueValidator(1)])),
                ('body_text', models.TextField(max_length=500)),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='coresite.Product')),
            ],
        ),
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100)),
                ('body_text', models.TextField(max_length=500)),
                ('creation_date', models.DateField(auto_now_add=True)),
                ('slug', models.SlugField(max_length=250, unique=True)),
                ('products', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='coresite.Product')),
            ],
            options={
                'ordering': ['-creation_date'],
            },
        ),
    ]
