From f1072ee677320436beb84e56696db7330d2be964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Grou=C3=A8s?= <valentin.groues@uni.lu> Date: Thu, 18 May 2017 09:33:06 +0200 Subject: [PATCH] don't import public holidays for flying team --- smash/web/management/commands/holidays.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/smash/web/management/commands/holidays.py b/smash/web/management/commands/holidays.py index cfd82b28..7c01d080 100644 --- a/smash/web/management/commands/holidays.py +++ b/smash/web/management/commands/holidays.py @@ -2,7 +2,7 @@ import datetime from django.core.management.base import BaseCommand -from ...models import Appointment, Location, AppointmentType +from ...models import Appointment, Location, AppointmentType, AppointmentTypeLink appointment_type_other = AppointmentType.objects.filter(code='OTHER').first() @@ -22,7 +22,7 @@ class Command(BaseCommand): parser.add_argument('year', nargs='+', type=int) def handle(self, *args, **options): - for location in Location.objects.all(): + for location in Location.objects.exclude(name="Flying Team").all(): for year in options['year']: self.stdout.write("importing holidays for year {} and location {}".format(year, location)) # new years day @@ -64,7 +64,8 @@ class Command(BaseCommand): holiday.comment = comment holiday.visit_id = None holiday.save() - holiday.appointment_types = [appointment_type_other] + link = AppointmentTypeLink(appointment=holiday, appointment_type=appointment_type_other) + link.save() def get_easter_sunday_date(year): -- GitLab