diff --git a/smash/web/management/commands/holidays.py b/smash/web/management/commands/holidays.py index cfd82b2870bdc2d2b74cc85c53d8cdacdbc22177..7c01d080eecf0b2718506b3c7a33eebc566cf3ba 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):