Fix history migration.

This commit is contained in:
Emanuel Schütze 2019-01-20 10:56:50 +01:00
parent 251cc4acc1
commit c704b90ecb
1 changed files with 11 additions and 0 deletions

View File

@ -5,6 +5,16 @@ import jsonfield.fields
from django.db import migrations, models
def clear_history(apps, schema_editor):
"""
Deletes the full history.
"""
# We get the model from the versioned app registry;
# if we directly import it, it will be the wrong version.
History = apps.get_model("core", "History")
History.objects.all().delete()
class Migration(migrations.Migration):
dependencies = [
@ -17,6 +27,7 @@ class Migration(migrations.Migration):
name='restricted',
field=models.BooleanField(default=False),
),
migrations.RunPython(clear_history),
migrations.AlterField(
model_name='history',
name='information',