Skip to content
Snippets Groups Projects
Commit 093d5187 authored by Carlos Vega's avatar Carlos Vega
Browse files

To avoid the following error:

======================================================================
ERROR: web.tests.test_holidays (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: web.tests.test_holidays
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 254, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
    __import__(name)
  File "/Users/carlos.vega/dev/scheduling-system/smash/web/tests/test_holidays.py", line 3, in <module>
    from web.management.commands.holidays import get_easter_sunday_date, get_ascension_day, get_pentecost_day
  File "/Users/carlos.vega/dev/scheduling-system/smash/web/management/commands/holidays.py", line 7, in <module>
    appointment_type_other = AppointmentType.objects.filter(code='OTHER').first()
  File "/Users/carlos.vega/dev/scheduling-system/env/lib/python2.7/site-packages/django/db/models/query.py", line 564, in first
    objects = list((self if self.ordered else self.order_by('pk'))[:1])
  File "/Users/carlos.vega/dev/scheduling-system/env/lib/python2.7/site-packages/django/db/models/query.py", line 250, in __iter__
    self._fetch_all()
  File "/Users/carlos.vega/dev/scheduling-system/env/lib/python2.7/site-packages/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/Users/carlos.vega/dev/scheduling-system/env/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/Users/carlos.vega/dev/scheduling-system/env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 894, in execute_sql
    raise original_exception
ProgrammingError: relation "web_appointmenttype" does not exist
LINE 1: ...ed", "web_appointmenttype"."required_worker" FROM "web_appoi...
parent 18ae699e
No related branches found
No related tags found
1 merge request!192Feature/add way to change password and PERMISSIONS
......@@ -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.filter(code='OTHER').first()
link = AppointmentTypeLink(appointment=holiday, appointment_type=appointment_type_other)
link.save()
......
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