# Generated by Django 3.1.4 on 2020-12-20 07:45

import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(verbose_name='Основной текст')),
                ('is_correct', models.BooleanField(default=False, verbose_name='Ответ верный?')),
                ('rating', models.IntegerField(default=0, verbose_name='Рейтинг')),
            ],
            options={
                'verbose_name': 'Ответ',
                'verbose_name_plural': 'Ответы',
            },
        ),
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('avatar', models.ImageField(default='pizza.jpg', upload_to='', verbose_name='Аватар')),
                ('nickname', models.CharField(max_length=64, verbose_name='Имя')),
                ('user', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Профиль',
                'verbose_name_plural': 'Профили',
            },
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=256, verbose_name='Заголовок')),
                ('text', models.TextField(verbose_name='Основной текст')),
                ('published_date', models.DateField(default=datetime.date.today, verbose_name='Дата публикации')),
                ('rating', models.IntegerField(default=0, verbose_name='Рейтинг')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='AskNakaznoy.profile')),
            ],
            options={
                'verbose_name': 'Вопрос',
                'verbose_name_plural': 'Вопросы',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=32, verbose_name='Имя тэга')),
            ],
            options={
                'verbose_name': 'Тэг',
                'verbose_name_plural': 'Тэги',
            },
        ),
        migrations.CreateModel(
            name='QuestionLike',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_liked', models.IntegerField(choices=[(1, 'Like'), (0, 'Nolike'), (-1, 'Dislike')], default=0)),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='AskNakaznoy.question', verbose_name='questionlikes')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='AskNakaznoy.profile')),
            ],
            options={
                'verbose_name': 'Лайк вопроса',
                'verbose_name_plural': 'Лайки на вопросе',
            },
        ),
        migrations.AddField(
            model_name='question',
            name='likes',
            field=models.ManyToManyField(blank=True, related_name='liked_questions', through='AskNakaznoy.QuestionLike', to='AskNakaznoy.Profile'),
        ),
        migrations.AddField(
            model_name='question',
            name='tags',
            field=models.ManyToManyField(blank=True, related_name='questions', to='AskNakaznoy.Tag', verbose_name='Tags'),
        ),
        migrations.CreateModel(
            name='AnswerLike',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_liked', models.IntegerField(choices=[(1, 'Like'), (0, 'Nolike'), (-1, 'Dislike')], default=0)),
                ('answer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='AskNakaznoy.answer', verbose_name='answerlikes')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='AskNakaznoy.profile')),
            ],
            options={
                'verbose_name': 'Лайк ответа',
                'verbose_name_plural': 'Лайки на ответе',
            },
        ),
        migrations.AddField(
            model_name='answer',
            name='author',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='AskNakaznoy.profile'),
        ),
        migrations.AddField(
            model_name='answer',
            name='likes',
            field=models.ManyToManyField(blank=True, related_name='liked_answers', through='AskNakaznoy.AnswerLike', to='AskNakaznoy.Profile'),
        ),
        migrations.AddField(
            model_name='answer',
            name='question',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='AskNakaznoy.question'),
        ),
    ]
