SOITA/answers/migrations/0001_initial.py
Hubert Jankowski 539c4690cb changers
2021-12-05 13:50:34 +01:00

30 lines
979 B
Python

# Generated by Django 3.1.1 on 2021-12-01 18:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('questions', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Answer',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField()),
('is_correct', models.BooleanField(default=False)),
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='answers', to='questions.question')),
],
),
migrations.AddConstraint(
model_name='answer',
constraint=models.UniqueConstraint(condition=models.Q(is_correct=True), fields=('question',), name='only_one_correct_answer'),
),
]