# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-10 18:18
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=255)),
                ('is_correct', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField()),
                ('qtype', models.IntegerField(choices=[(1, 'Single Correct Answer'), (2, 'Multiple Correct Answers')], default=1, verbose_name='Type')),
            ],
        ),
        migrations.CreateModel(
            name='Topic',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255)),
                ('description', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='TopicQuestionRelation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order', models.PositiveIntegerField(blank=True, default=0)),
                ('active', models.BooleanField(default=True)),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topic_relation', to='questions.Question')),
                ('topic', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='question_relation', to='questions.Topic')),
            ],
            options={
                'verbose_name': 'Linked Question',
                'verbose_name_plural': 'Linked Questions',
                'ordering': ('order',),
            },
        ),
        migrations.AddField(
            model_name='topic',
            name='questions',
            field=models.ManyToManyField(related_name='topics', through='questions.TopicQuestionRelation', to='questions.Question'),
        ),
        migrations.AddField(
            model_name='answer',
            name='question',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='questions.Question'),
        ),
        migrations.AlterUniqueTogether(
            name='topicquestionrelation',
            unique_together=set([('question', 'topic')]),
        ),
    ]
