diff --git a/smash/web/management/commands/holidays.py b/smash/web/management/commands/holidays.py index 7c01d080eecf0b2718506b3c7a33eebc566cf3ba..ab0db550f47af4e947158e7593b406daa819fc6b 100644 --- a/smash/web/management/commands/holidays.py +++ b/smash/web/management/commands/holidays.py @@ -4,9 +4,6 @@ from django.core.management.base import BaseCommand from ...models import Appointment, Location, AppointmentType, AppointmentTypeLink -appointment_type_other = AppointmentType.objects.filter(code='OTHER').first() - - def get_easter_monday(easter_sunday): return next_weekday(easter_sunday, 0) @@ -64,6 +61,7 @@ class Command(BaseCommand): holiday.comment = comment holiday.visit_id = None holiday.save() + appointment_type_other = AppointmentType.objects.get_or_create(code='OTHER', defaults={default_duration: 60}) link = AppointmentTypeLink(appointment=holiday, appointment_type=appointment_type_other) link.save() @@ -92,4 +90,4 @@ def next_weekday(day_datetime, week_day): days_ahead = week_day - day_datetime.weekday() if days_ahead <= 0: days_ahead += 7 - return day_datetime + datetime.timedelta(days_ahead) + return day_datetime + datetime.timedelta(days_ahead) \ No newline at end of file