datatracker/ietf/submit/migrations/0012_auto_20160414_1902.py
Henrik Levkowetz 9cb627f1cc Made some migrations work backwards, too.
- Legacy-Id: 11964
2016-09-10 20:06:15 +00:00

35 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
def add_draft_submission_state_name(apps, schema_editor):
# We can't import the model directly as it may be a newer
# version than this migration expects. We use the historical version.
DraftSubmissionStateName = apps.get_model("name", "DraftSubmissionStateName")
DraftSubmissionStateName.objects.create(slug="waiting-for-draft",
name="Manual Post Waiting for Draft",
desc="",
used=True,
order=8)
def del_draft_submission_state_name(apps, schema_editor):
# We can't import the model directly as it may be a newer
# version than this migration expects. We use the historical version.
DraftSubmissionStateName = apps.get_model("name", "DraftSubmissionStateName")
DraftSubmissionStateName.objects.filter(slug="waiting-for-draft",
name="Manual Post Waiting for Draft",
desc="",
used=True,
order=8).delete()
dependencies = [
('submit', '0011_submissionemail'),
]
operations = [
migrations.RunPython(add_draft_submission_state_name, del_draft_submission_state_name),
]