update anatomy to remove sortedm2m

This commit is contained in:
Ross
2024-02-17 22:50:57 +00:00
parent 4e7838c17f
commit 0bc2830ea2
6 changed files with 79 additions and 8 deletions
@@ -0,0 +1,30 @@
# Generated by Django 4.1.4 on 2024-02-17 22:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('anatomy', '0013_rename_exam_collection_exam_examcollection'),
]
operations = [
migrations.CreateModel(
name='ExamQuestionDetail',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('exam', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='anatomy.exam')),
('anatomyquestion', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='anatomy.anatomyquestion')),
('sort_order', models.IntegerField(default=1000)),
],
options={
'ordering': ('sort_order',),
},
),
migrations.RunSQL(
"""INSERT INTO anatomy_examquestiondetail
SELECT * FROM anatomy_exam_exam_questions;"""
),
]
@@ -0,0 +1,22 @@
# Generated by Django 4.1.4 on 2024-02-17 22:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('anatomy', '0014_examquestiondetail'),
]
operations = [
migrations.RemoveField(
model_name='exam',
name='exam_questions',
),
migrations.AddField(
model_name='exam',
name='exam_questions',
field=models.ManyToManyField(related_name='exams', through='anatomy.ExamQuestionDetail', to='anatomy.anatomyquestion'),
),
]