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

appointment colors include location

coloring of appointments base #	modified:   smash/web/models/appointment.py
parent 3c487c4c
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 13:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0025_configurationitem_calendar_items'),
]
operations = [
migrations.AddField(
model_name='location',
name='color',
field=models.CharField(blank=True, default=b'', max_length=20),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-04-04 13:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0026_location_color'),
]
operations = [
migrations.AlterField(
model_name='location',
name='color',
field=models.CharField(blank=True, default=b'', max_length=20, verbose_name=b'Calendar appointment color'),
),
]
......@@ -92,6 +92,8 @@ class Appointment(models.Model):
result = ConfigurationItem.objects.get(type=NO_SHOW_APPOINTMENT_COLOR_CONFIGURATION_TYPE).value
elif self.status == Appointment.APPOINTMENT_STATUS_CANCELLED:
result = ConfigurationItem.objects.get(type=CANCELLED_APPOINTMENT_COLOR_CONFIGURATION_TYPE).value
elif (self.location.color is not None) and (self.location.color != ""):
result = self.location.color
else:
priority = 1000000
for type in self.appointment_types.all():
......
......@@ -8,6 +8,11 @@ class Location(models.Model):
name = models.CharField(max_length=20)
color = models.CharField(max_length=20,
verbose_name='Calendar appointment color',
blank=True,
default="")
def __str__(self):
return "%s" % self.name
......
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