# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-04-04 09:43 from __future__ import unicode_literals from django.db import migrations from web.models.constants import CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE, \ NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE def configuration_item_color_fields(apps, schema_editor): # We can't import the ConfigurationItem model directly as it may be a newer # version than this migration expects. We use the historical version. ConfigurationItem = apps.get_model("web", "ConfigurationItem") cancelled_appointment_color = ConfigurationItem.objects.create() cancelled_appointment_color.type = CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE cancelled_appointment_color.value = "#b7babf" cancelled_appointment_color.name = "Color for cancelled appointments" cancelled_appointment_color.save() cancelled_appointment_color = ConfigurationItem.objects.create() cancelled_appointment_color.type = NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE cancelled_appointment_color.value = "#ff0000" cancelled_appointment_color.name = "Color for NO SHOW appointments" cancelled_appointment_color.save() class Migration(migrations.Migration): dependencies = [ ('web', '0024_configurationitem'), ] operations = [ migrations.RunPython(configuration_item_color_fields), ]