def create_service_type(apps, schema_editor):
    service_types = {
        1: 'OpenStack',
        2: 'DigitalOcean',
        3: 'Amazon',
        4: 'Jira',
        5: 'GitLab',
        6: 'Oracle',
        7: 'Azure',
        8: 'SugarCRM',
        9: 'SaltStack',
        10: 'Zabbix'
    }

    ServiceSettings = apps.get_model('structure', 'ServiceSettings')
    for service in ServiceSettings.objects.all():
        try:
            service.service_type = service_types[service.type]
            service.save()
        except __HOLE__:
            if service.type in service_types.values():
                service.service_type = service.type
                service.save()
            else:
                logger.warning('Cannot migrate service type %s' % service.type)
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/structure/migrations/0028_servicesettings_service_type2.py/create_service_type