Skip to content
Snippets Groups Projects
Commit d4ee1729 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

initial values for configuration calendar colors added

parent 5d8d9542
No related branches found
No related tags found
1 merge request!37Custom calendar colors for appointment location and appointment status
# -*- 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),
]
...@@ -27,3 +27,6 @@ CONTACT_TYPES_CHOICES = ( ...@@ -27,3 +27,6 @@ CONTACT_TYPES_CHOICES = (
(CONTACT_TYPES_PHONE, 'Phone'), (CONTACT_TYPES_PHONE, 'Phone'),
(CONTACT_TYPES_SMS, 'SMS'), (CONTACT_TYPES_SMS, 'SMS'),
) )
CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE = "CANCELLED_APPOINTMENT_COLOR"
NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE = "NO_SHOW_APPOINTMENT_COLOR"
from django.test import TestCase
from web.models import ConfigurationItem
from web.models.constants import CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE, \
NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE
class ConfigurationItemModelTests(TestCase):
def test_init_data(self):
items = ConfigurationItem.objects.filter(type=CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE)
self.assertTrue(len(items) > 0)
items = ConfigurationItem.objects.filter(type=NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE)
self.assertTrue(len(items) > 0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment