# Generated by Django 2.2.2 on 2021-07-26 17:51

import ckeditor_uploader.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import mptt.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='Имя рубрики')),
                ('name_en', models.CharField(max_length=255, null=True, verbose_name='Имя рубрики')),
                ('name_ru', models.CharField(max_length=255, null=True, verbose_name='Имя рубрики')),
                ('slug', models.SlugField(max_length=255, unique=True, verbose_name='Ссылка')),
                ('photo', models.ImageField(blank=True, null=True, upload_to='image', verbose_name='Изображение')),
                ('lft', models.PositiveIntegerField(editable=False)),
                ('rght', models.PositiveIntegerField(editable=False)),
                ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
                ('level', models.PositiveIntegerField(editable=False)),
                ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='news.Category', verbose_name='Родитель')),
            ],
            options={
                'verbose_name': 'Рубрика',
                'verbose_name_plural': 'Рубрики',
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(verbose_name='текст коментария')),
                ('timestamp', models.DateTimeField(auto_now=True, verbose_name='Дата создания комментария')),
                ('is_child', models.BooleanField(default=False)),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='comment_children', to='news.Comment', verbose_name='Коментарий к коментарию')),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('button', models.CharField(choices=[('Publish', 'Опубликовать'), ('Not_to_publish', 'Не публиковать')], max_length=30, verbose_name='Статус')),
                ('name', models.CharField(max_length=30, verbose_name='Название(ru)')),
                ('name_en', models.CharField(max_length=30, null=True, verbose_name='Название(ru)')),
                ('name_ru', models.CharField(max_length=30, null=True, verbose_name='Название(ru)')),
                ('image', models.ImageField(blank=True, null=True, upload_to='', verbose_name='Изображение')),
                ('slug', models.SlugField(max_length=255, unique=True, verbose_name='Ссылка')),
            ],
            options={
                'verbose_name': 'Метка',
                'verbose_name_plural': 'Метки',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.CharField(choices=[('Publish', 'Опубликовать'), ('Not_to_publish', 'Не публиковать')], default='P', max_length=30, verbose_name='Статус')),
                ('yved', models.BooleanField(default=False, verbose_name='Уведомить')),
                ('title', models.CharField(db_index=True, max_length=255, verbose_name='Наименование')),
                ('title_en', models.CharField(db_index=True, max_length=255, null=True, verbose_name='Наименование')),
                ('title_ru', models.CharField(db_index=True, max_length=255, null=True, verbose_name='Наименование')),
                ('slug', models.SlugField(unique=True, verbose_name='Ссылка')),
                ('content', ckeditor_uploader.fields.RichTextUploadingField(blank=True, verbose_name='Описание')),
                ('content_en', ckeditor_uploader.fields.RichTextUploadingField(blank=True, null=True, verbose_name='Описание')),
                ('content_ru', ckeditor_uploader.fields.RichTextUploadingField(blank=True, null=True, verbose_name='Описание')),
                ('image', models.ImageField(blank=True, null=True, upload_to='media/image/', verbose_name='Изображение')),
                ('views', models.IntegerField(default=0, verbose_name='Количество просмотров')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Дата создания')),
                ('update_at', models.DateTimeField(auto_now=True, verbose_name='Дата обновления')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Автор')),
                ('category', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='news.Category', verbose_name='Рубрики')),
                ('tags', models.ManyToManyField(to='news.Tag', verbose_name='Тэг')),
            ],
            options={
                'verbose_name': 'Статья(ю)',
                'verbose_name_plural': 'Статьи',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='Complain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('comment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='news.Comment', verbose_name='Коментарий')),
                ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='news.Post', verbose_name='Запись')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='автор')),
            ],
        ),
        migrations.AddField(
            model_name='comment',
            name='post',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='news.Post', verbose_name='Пост'),
        ),
        migrations.AddField(
            model_name='comment',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='автор'),
        ),
    ]
