# Generated by Django 3.1.3 on 2020-12-04 19:20

import app.common.models
import ckeditor_uploader.fields
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='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is active?')),
                ('title', models.CharField(max_length=30, verbose_name='Title')),
            ],
            options={
                'verbose_name': 'category',
                'verbose_name_plural': 'categories',
            },
        ),
        migrations.CreateModel(
            name='Course',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('lang', models.CharField(choices=[('en', 'English'), ('ru', 'Russian'), ('kk', 'Kazakh')], default='en', max_length=2, verbose_name='Language')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Created')),
                ('modified', app.common.models.MyDateTimeField(auto_now=True, verbose_name='Modified')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is active?')),
                ('title', models.CharField(max_length=30, verbose_name='Title')),
                ('description', models.TextField(blank=True, default='', verbose_name='Description')),
                ('teacher', models.CharField(max_length=150, verbose_name='Teacher')),
                ('requirements', models.TextField(blank=True, null=True, verbose_name='Requirements')),
                ('cover_image', models.ImageField(upload_to='', verbose_name='Cover image')),
                ('registered_count', models.BigIntegerField(default=0, verbose_name='Registration count')),
                ('author', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='course_author', to=settings.AUTH_USER_MODEL)),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_category', to='courses.category', verbose_name='Category')),
            ],
            options={
                'verbose_name': 'course',
                'verbose_name_plural': 'courses',
                'ordering': ('-created',),
            },
        ),
        migrations.CreateModel(
            name='Chapter',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=30, verbose_name='Title')),
                ('description', models.TextField(blank=True, default='', verbose_name='Description')),
                ('order', models.PositiveSmallIntegerField(db_index=True, default=0, editable=False, verbose_name='Order')),
                ('content', ckeditor_uploader.fields.RichTextUploadingField(verbose_name='Content')),
                ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chapters', to='courses.course', verbose_name='Course')),
            ],
            options={
                'verbose_name': 'Chapter',
                'verbose_name_plural': 'Chapter',
                'ordering': ('order',),
            },
        ),
        migrations.CreateModel(
            name='CourseProgress',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('registered', models.DateTimeField(auto_now_add=True, verbose_name='Registered')),
                ('is_active', models.BooleanField(default=False, verbose_name='Is active')),
                ('is_finished', models.BooleanField(default=False, verbose_name='Is finished')),
                ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='registered', to='courses.course', verbose_name='Course')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='courses', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'course progress',
                'verbose_name_plural': 'course progresses',
                'ordering': ('-registered',),
                'unique_together': {('user', 'course')},
            },
        ),
    ]
