You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

21 lines
564 B

# Generated by Django 2.1.3 on 2018-11-20 20:04
import json
from django.db import migrations
def combine_channel_names(apps, schema_editor):
Channel = apps.get_model("api", "Channel")
for channel in Channel.objects.filter(kind="sms"):
if channel.value.startswith("{"):
doc = json.loads(channel.value)
channel.name = doc.get("label", "")
channel.save()
class Migration(migrations.Migration):
dependencies = [("api", "0043_channel_name")]
operations = [migrations.RunPython(combine_channel_names)]