# -*- 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 KIT_RECIPIENT_EMAIL_CONFIGURATION_TYPE, \ KIT_EMAIL_HOUR_CONFIGURATION_TYPE, \ KIT_EMAIL_DAY_OF_WEEK_CONFIGURATION_TYPE def create_item(apps, type, value, name): # 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") item = ConfigurationItem.objects.create() item.type = type item.value = value item.name = name item.save() def configuration_items(apps, schema_editor): create_item(apps, KIT_RECIPIENT_EMAIL_CONFIGURATION_TYPE, "kit.receipents@lu;with.semicolon@separation.lu", "Recipients of kit requests email") create_item(apps, KIT_EMAIL_HOUR_CONFIGURATION_TYPE, "17:00", "At what time kit request emails should be sent") create_item(apps, KIT_EMAIL_DAY_OF_WEEK_CONFIGURATION_TYPE, "FRIDAY", "At what weekday kit request emails should be sent") class Migration(migrations.Migration): dependencies = [ ('web', '0031_appointment_post_mail_sent'), ] operations = [ migrations.RunPython(configuration_items), ]