forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0011_constraintname_editor_label.py
More file actions
36 lines (28 loc) · 1.07 KB
/
0011_constraintname_editor_label.py
File metadata and controls
36 lines (28 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
# Copyright The IETF Trust 2020, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('name', '0010_timerangename'),
]
def fill_in_editor_labels(apps, schema_editor):
ConstraintName = apps.get_model('name', 'ConstraintName')
for cn in ConstraintName.objects.all():
cn.editor_label = {
'conflict': "(1)",
'conflic2': "(2)",
'conflic3': "(3)",
'bethere': "(person)",
}.get(cn.slug, cn.slug)
cn.save()
def noop(apps, schema_editor):
pass
operations = [
migrations.AddField(
model_name='constraintname',
name='editor_label',
field=models.CharField(blank=True, help_text='Very short label for producing warnings inline in the sessions in the schedule editor.', max_length=32),
),
migrations.RunPython(fill_in_editor_labels, noop, elidable=True),
]