Commit 5d3f4fb8 authored by Tom van Bussel's avatar Tom van Bussel

Add a missing migration in the education app

parent 9657cf64
from django.db import migrations, models
def forwards_func(apps, schema_editor):
Exam = apps.get_model('education', 'Exam')
for exam in Exam.objects.all():
if exam.type == 'answers':
exam.type = 'exam_answers'
exam.save(update_fields=('type',))
def reverse_func(apps, schema_editor):
Exam = apps.get_model('education', 'Exam')
for exam in Exam.objects.all():
if exam.type in ['exam_answers', 'partial_answers', 'resit_answers',
'practice_answers']:
exam.type = 'answers'
exam.save(update_fields=('type',))
class Migration(migrations.Migration):
dependencies = [
# Without this dependency we get multiple leaf nodes
('education', '0006_auto_20171013_1535'),
# The real dependency
('education', '0005_auto_20170906_2109'),
]
operations = [
migrations.RunPython(forwards_func, reverse_func),
]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment