forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0006_statements.py
More file actions
43 lines (33 loc) · 1.07 KB
/
Copy path0006_statements.py
File metadata and controls
43 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Copyright The IETF Trust 2023, All Rights Reserved
from django.db import migrations
def forward(apps, schema_editor):
StateType = apps.get_model("doc", "StateType")
State = apps.get_model("doc", "State")
StateType.objects.create(slug="statement", label="Statement State")
State.objects.create(
slug="active",
type_id="statement",
name="Active",
order=0,
desc="The statement is active",
)
State.objects.create(
slug="replaced",
type_id="statement",
name="Replaced",
order=0,
desc="The statement has been replaced",
)
def reverse(apps, schema_editor):
StateType = apps.get_model("doc", "StateType")
State = apps.get_model("doc", "State")
State.objects.filter(type_id="statement").delete()
StateType.objects.filter(slug="statement").delete()
class Migration(migrations.Migration):
dependencies = [
("doc", "0005_alter_docevent_type"),
("name", "0004_statements"),
]
operations = [
migrations.RunPython(forward, reverse),
]