61 lines
2 KiB
Python
61 lines
2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.10.5 on 2017-03-04 04:58
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations
|
|
from django.utils.text import slugify
|
|
|
|
reordered_states = [
|
|
# old, new, slug
|
|
(8, 10, 'chair-w'),
|
|
(9, 11, 'writeupw'),
|
|
(10, 12, 'sub-pub'),
|
|
]
|
|
|
|
new_states = [
|
|
(8, "Waiting for Implementation",
|
|
"In some areas, it can be desirable to wait for multiple interoperable "
|
|
"implementations before progressing a draft to be an RFC, and in some "
|
|
"WGs this is required. This state should be entered after WG Last Call "
|
|
"has completed."),
|
|
(9, "Held by WG", "Held by WG, see document history for details.",),
|
|
]
|
|
|
|
def forwards(apps,schema_editor):
|
|
State = apps.get_model('doc', 'State')
|
|
StateType = apps.get_model('doc', 'StateType')
|
|
wg_type = StateType.objects.get(slug='draft-stream-ietf')
|
|
# change order on some existing states to make room for the new ones
|
|
for old_order, new_order, slug in reordered_states:
|
|
state = State.objects.get(type=wg_type, slug=slug)
|
|
state.order=new_order
|
|
state.save()
|
|
for order, name, desc in new_states:
|
|
slug = slugify(name)
|
|
State.objects.create(type=wg_type, slug=slug, name=name, used=True, desc=desc, order=order, )
|
|
|
|
|
|
def backwards(apps,schema_editor):
|
|
State = apps.get_model('doc', 'State')
|
|
StateType = apps.get_model('doc', 'StateType')
|
|
wg_type = StateType.objects.get(slug='draft-stream-ietf')
|
|
# change order on some existing states to make room for the new ones
|
|
for old_order, new_order, slug in reordered_states:
|
|
state = State.objects.get(type=wg_type, slug=slug)
|
|
state.order=old_order
|
|
state.save()
|
|
for order, name, desc in new_states:
|
|
slug = slugify(name)
|
|
State.objects.get(type=wg_type, slug=slug).delete()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('doc', '0020_auto_20170224_0222'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(forwards, backwards),
|
|
]
|