示例#1
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('account', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Quiz',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('quiz_id', models.IntegerField(default=Quizes.models.unique_code_generator, unique=True)),
                ('name', models.CharField(max_length=30)),
                ('category', models.CharField(default='Not metioned', max_length=30)),
                ('difficulty', models.CharField(choices=[('easy', 'easy'), ('medium', 'medium'), ('hard', 'hard')], default='easy', max_length=6)),
                ('pass_mark', models.IntegerField(default=35)),
                ('created_at', models.DateField(auto_now_add=True)),
                ('school', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.school')),
            ],
        ),
        migrations.CreateModel(
            name='Question',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=120, unique=True)),
                ('is_multi_answer_question', models.BooleanField(default=False)),
                ('correct_option', models.CharField(choices=[('a', 'a'), ('b', 'b'), ('c', 'c'), ('d', 'd')], max_length=1)),
                ('quiz', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Quizes.quiz')),
            ],
        ),
        migrations.CreateModel(
            name='Answer',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('option', models.CharField(choices=[('a', 'a'), ('b', 'b'), ('c', 'c'), ('d', 'd')], max_length=1)),
                ('text', models.CharField(max_length=16)),
                ('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Quizes.question')),
            ],
        ),
    ]
示例#2
0
class Migration(migrations.Migration):

    dependencies = [
        ('Quizes', '0006_auto_20210414_1336'),
    ]

    operations = [
        migrations.AlterField(
            model_name='quiz',
            name='quiz_id',
            field=models.IntegerField(
                default=Quizes.models.unique_code_generator),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('Quizes', '0005_auto_20210414_1303'),
    ]

    operations = [
        migrations.AlterField(
            model_name='quiz',
            name='quiz_id',
            field=models.IntegerField(
                blank=True,
                default=Quizes.models.unique_code_generator,
                null=True),
        ),
    ]