OpenSlides/openslides/motions/migrations/0031_state_css_classes_2.py
GabrielMeyer bb55110245 Fixes dynamic growing cells in workflows
- The cells in the table of a workflow are dynamically growing
- The colors of the states get new labels
- If multiple selection in motion-list is active, the button to change the view won't be seen
2019-07-23 15:01:35 +02:00

29 lines
672 B
Python

# Generated by Finn Stutzenstein on 2019-07-17 08:43
from django.db import migrations
LABEL_MAPPING = {
"default": "grey",
"primary": "lightblue",
"success": "green",
"danger": "red",
"warning": "yellow",
}
def rename_css_classes(apps, schema_editor):
State = apps.get_model("motions", "State")
for state in State.objects.all():
old_class = state.css_class
state.css_class = LABEL_MAPPING.get(old_class, "lightblue")
state.save(skip_autoupdate=True)
class Migration(migrations.Migration):
dependencies = [("motions", "0030_state_css_classes_1")]
operations = [migrations.RunPython(rename_css_classes)]