Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template error: #458

Open
JVKeller opened this issue Jan 10, 2025 · 6 comments
Open

Template error: #458

JVKeller opened this issue Jan 10, 2025 · 6 comments

Comments

@JVKeller
Copy link

I have been having a heck of a time trying to get this running. It was fine for a while while I was working on something but now I keep hitting walls.

This is the current error I'm getting:

Template error:
In template /opt/Horilla_Main/horilla/templates/notification/notification_items.html, error at line 116
   relation "base_notificationsound" does not exist
Exception Type: ProgrammingError at /
Exception Value: relation "base_notificationsound" does not exist
LINE 1: ...d", "base_notificationsound"."sound_enabled" FROM "base_noti...
                                                             ^

Let me know if you need more info...

@JVKeller
Copy link
Author

Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 4.2.11
Python Version: 3.11.2
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'notifications',
 'mathfilters',
 'corsheaders',
 'simple_history',
 'django_filters',
 'base',
 'employee',
 'recruitment',
 'leave',
 'pms',
 'onboarding',
 'asset',
 'attendance',
 'payroll',
 'widget_tweaks',
 'django_apscheduler',
 'accessibility',
 'horilla_audit',
 'horilla_widgets',
 'horilla_crumbs',
 'horilla_documents',
 'haystack',
 'horilla_views',
 'horilla_automations',
 'auditlog',
 'biometric',
 'helpdesk',
 'offboarding',
 'rest_framework',
 'rest_framework_simplejwt',
 'drf_yasg',
 'horilla_api']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'simple_history.middleware.HistoryRequestMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'auditlog.middleware.AuditlogMiddleware',
 'base.middleware.CompanyMiddleware',
 'horilla.horilla_middlewares.MethodNotAllowedMiddleware',
 'horilla.horilla_middlewares.ThreadLocalMiddleware',
 'accessibility.middlewares.AccessibilityMiddleware',
 'accessibility.middlewares.AccessibilityMiddleware',
 'base.middleware.ForcePasswordChangeMiddleware',
 'attendance.middleware.AttendanceMiddleware']


Template error:
In template /opt/Horilla_Main/horilla/templates/notification/notification_items.html, error at line 116
   relation "base_notificationsound" does not exist
LINE 1: ...d", "base_notificationsound"."sound_enabled" FROM "base_noti...
                                                             ^

   106 : <div class="oh-navbar__notification-footer" x-show="visible" style="position:relative;">
   107 :     <a
   108 :         id="viewallnotification"
   109 :         data-target="#allNotifications"
   110 :         hx-get="{% url 'all-notifications' %}"
   111 :         hx-target="#allNotificationBody"
   112 :         class="oh-navbar__notification-tray-link oh-activity-sidebar__open"
   113 :         >{% trans "View all notifications" %} </a
   114 :     >
   115 :     <div class="oh-navbar__volume-icon" title="{% trans 'Notification Sound' %}" style="position:absolute; right:25px" hx-get="{% url 'notifications:notification-sound' %}" hx-swap="none">
   116 :          {% if request.user.employee_get.notification_sound.sound_enabled %} 
   117 :         <span class="material-symbols-outlined text-danger">
   118 :             volume_up
   119 :         </span>
   120 :         {% else %}
   121 :         <span class="material-symbols-outlined text-danger">
   122 :             volume_off
   123 :         </span>
   124 :         {% endif %}
   125 :     </div>
   126 : </div>


Traceback (most recent call last):
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 880, in _resolve_lookup
    current = current[bit]
              ^^^^^^^^^^^^

During handling of the above exception ('Employee' object is not subscriptable), another exception occurred:
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/fields/related_descriptors.py", line 473, in __get__
    rel_obj = self.related.get_cached_value(instance)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/fields/mixins.py", line 15, in get_cached_value
    return instance._state.fields_cache[cache_name]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

During handling of the above exception ('notification_sound'), another exception occurred:
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The above exception (relation "base_notificationsound" does not exist
LINE 1: ...d", "base_notificationsound"."sound_enabled" FROM "base_noti...
                                                             ^
) was the direct cause of the following exception:
  File "/opt/Horilla_Main/horilla/horilla/decorators.py", line 234, in wrapped_view
    func = view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horilla/base/views.py", line 814, in home
    return render(request, "index.html", context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/shortcuts.py", line 24, in render
    content = loader.render_to_string(template_name, context, request, using=using)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 175, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/loader_tags.py", line 208, in render
    return template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 177, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/loader_tags.py", line 208, in render
    return template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 177, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/defaulttags.py", line 314, in render
    match = condition.eval(context)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/defaulttags.py", line 877, in eval
    return self.value.resolve(context, ignore_failures=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 715, in resolve
    obj = self.var.resolve(context)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 847, in resolve
    value = self._resolve_lookup(context)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 890, in _resolve_lookup
    current = getattr(current, bit)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/fields/related_descriptors.py", line 481, in __get__
    rel_obj = self.get_queryset(instance=instance).get(**filter_args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/query.py", line 633, in get
    num = len(clone)
          ^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/query.py", line 380, in __len__
    self._fetch_all()
    ^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/query.py", line 1881, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/query.py", line 91, in __iter__
    results = compiler.execute_sql(
              
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
    cursor.execute(sql, params)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
           
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

During handling of the above exception (relation "base_notificationsound" does not exist
LINE 1: ...d", "base_notificationsound"."sound_enabled" FROM "base_noti...
                                                             ^
), another exception occurred:
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 880, in _resolve_lookup
    current = current[bit]
              ^^^^^^^^^^^^

During handling of the above exception ('Employee' object is not subscriptable), another exception occurred:
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/fields/related_descriptors.py", line 473, in __get__
    rel_obj = self.related.get_cached_value(instance)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/fields/mixins.py", line 15, in get_cached_value
    return instance._state.fields_cache[cache_name]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

During handling of the above exception ('notification_sound'), another exception occurred:
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The above exception (relation "base_notificationsound" does not exist
LINE 1: ...d", "base_notificationsound"."sound_enabled" FROM "base_noti...
                                                             ^
) was the direct cause of the following exception:
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horilla/horilla/decorators.py", line 249, in wrapped_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horilla/base/views.py", line 814, in home
    return render(request, "index.html", context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/shortcuts.py", line 24, in render
    content = loader.render_to_string(template_name, context, request, using=using)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 175, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/loader_tags.py", line 208, in render
    return template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 177, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/loader_tags.py", line 208, in render
    return template.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 177, in render
    return self._render(context)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 966, in render_annotated
    return self.render(context)
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/defaulttags.py", line 314, in render
    match = condition.eval(context)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/defaulttags.py", line 877, in eval
    return self.value.resolve(context, ignore_failures=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 715, in resolve
    obj = self.var.resolve(context)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 847, in resolve
    value = self._resolve_lookup(context)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/template/base.py", line 890, in _resolve_lookup
    current = getattr(current, bit)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/fields/related_descriptors.py", line 481, in __get__
    rel_obj = self.get_queryset(instance=instance).get(**filter_args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/query.py", line 633, in get
    num = len(clone)
          ^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/query.py", line 380, in __len__
    self._fetch_all()
    ^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/query.py", line 1881, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/query.py", line 91, in __iter__
    results = compiler.execute_sql(
              
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
    cursor.execute(sql, params)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
           
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Horilla_Main/horillavenv/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Exception Type: ProgrammingError at /
Exception Value: relation "base_notificationsound" does not exist
LINE 1: ...d", "base_notificationsound"."sound_enabled" FROM "base_noti...
                                                             ^

@horilla-opensource
Copy link
Owner

Hi @JVKeller,

Thank you for reporting the issue you're encountering. It seems that the error is due to the database schema not being updated after pulling the latest changes. This often happens when migrations have not been applied.

Could you please try running the following commands in your project's root directory?

python manage.py makemigrations
python manage.py migrate

These commands will generate and apply any new database migrations, which should resolve the relation "base_notificationsound" does not exist error you're seeing.

Let me know if this works for you or if you need further assistance!

Best regards,
Team Horilla

@miscdevmanager
Copy link

Hi @horilla-opensource ,

I received the same error as @JVKeller when i did a fresh installation and was trying to use the demo database.

I ran python manage.py makemigrations and python manage.py migrate but the later command got this error.

(venv) PS C:\horilla> python manage.py migrate
Operations to perform:
Apply all migrations: accessibility, admin, asset, attendance, auditlog, auth, base, biometric, contenttypes, django_apscheduler, employee, helpdesk, horilla_audit, horilla_automations, horilla_documents, horilla_views, leave, notifications, offboarding, onboarding, payroll, pms, recruitment, sessions
Running migrations:
Applying accessibility.0002_initial...Traceback (most recent call last):
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\utils.py", line 87, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\sqlite3\base.py", line 324, in execute
return super().execute(query)
^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: table "accessibility_defaultaccessibility_employees" already exists

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Learning\horilla\manage.py", line 22, in
main()
File "C:\Learning\horilla\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Learning\horilla\venv\Lib\site-packages\django\core\management_init_.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Learning\horilla\venv\Lib\site-packages\django\core\management_init_.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Learning\horilla\venv\Lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Learning\horilla\venv\Lib\site-packages\django\core\management\base.py", line 458, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\core\management\base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\core\management\commands\migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\migrations\executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\migrations\migration.py", line 132, in apply
operation.database_forwards(
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\migrations\operations\fields.py", line 108, in database_forwards
schema_editor.add_field(
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\sqlite3\schema.py", line 387, in add_field
self.create_model(field.remote_field.through)
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\base\schema.py", line 451, in create_model
self.execute(sql, params or None)
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\base\schema.py", line 201, in execute
cursor.execute(sql, params)
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\utils.py", line 102, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\utils.py", line 84, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\utils.py", line 87, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Learning\horilla\venv\Lib\site-packages\django\db\backends\sqlite3\base.py", line 324, in execute
return super().execute(query)
^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: table "accessibility_defaultaccessibility_employees" already exists

@horilla-opensource
Copy link
Owner

horilla-opensource commented Jan 13, 2025

Hi @miscdevmanager ,

Please remove the test database from project directory and run the command again. (You'll have the option to load demo data from the login page also).

With Regards,
Team Horilla

@JVKeller
Copy link
Author

JVKeller commented Jan 13, 2025

@horilla-opensource
I've run that about 100 times now while working on adding the ability to reset vacation time on the employee anniversary date.

That also means I have a few extra fields in the database which I added manually, but that was never an issue before, and not showing in the error message. Just this notification sound that seems to be a new addition?

(I just did a completely fresh pull, same results. Removing the test database from the root dir also does not help)

@JVKeller
Copy link
Author

Temp work around:

delete all of the old migration files and cache

python3 manage.py migrate --fake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants