diff --git a/.DS_Store b/.DS_Store
index 76795849..d2afdf18 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/logs/hospital_management.log b/logs/hospital_management.log
index 186ecb58..5440e76e 100644
--- a/logs/hospital_management.log
+++ b/logs/hospital_management.log
@@ -103064,3 +103064,2077 @@ INFO 2025-08-30 16:12:35,213 basehttp 50146 6168834048 "GET /en/radiology/studie
INFO 2025-08-30 16:12:35,251 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
INFO 2025-08-30 16:12:39,410 basehttp 50146 6168834048 "GET /en/radiology/studies/219/ HTTP/1.1" 200 31565
INFO 2025-08-30 16:12:39,442 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:13:39,458 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:15:41,401 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:25:34,167 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:26:34,168 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:27:34,168 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:28:34,169 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:29:34,168 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:29:41,947 basehttp 50146 6168834048 "GET / HTTP/1.1" 302 0
+INFO 2025-08-30 16:29:41,972 basehttp 50146 13304360960 "GET /en/ HTTP/1.1" 200 47446
+INFO 2025-08-30 16:29:42,011 basehttp 50146 13304360960 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:29:42,028 basehttp 50146 13338013696 "GET /en/htmx/tenant-info/ HTTP/1.1" 200 1043
+INFO 2025-08-30 16:29:42,030 basehttp 50146 13321187328 "GET /en/htmx/system-health/ HTTP/1.1" 200 1359
+INFO 2025-08-30 16:29:42,030 basehttp 50146 6168834048 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:29:45,875 basehttp 50146 6168834048 "GET /en/ HTTP/1.1" 200 47446
+INFO 2025-08-30 16:29:45,932 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:29:45,934 basehttp 50146 13304360960 "GET /en/htmx/tenant-info/ HTTP/1.1" 200 1043
+INFO 2025-08-30 16:29:45,934 basehttp 50146 13338013696 "GET /en/htmx/system-health/ HTTP/1.1" 200 1359
+INFO 2025-08-30 16:29:45,936 basehttp 50146 13321187328 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:29:48,688 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:29:52,447 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:29:53,221 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:29:53,783 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:29:54,692 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:30:25,365 basehttp 50146 13321187328 "GET / HTTP/1.1" 302 0
+INFO 2025-08-30 16:30:25,378 basehttp 50146 13338013696 "GET /en/ HTTP/1.1" 200 47446
+INFO 2025-08-30 16:30:25,444 basehttp 50146 13338013696 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:30:25,446 basehttp 50146 6168834048 "GET /en/htmx/system-health/ HTTP/1.1" 200 1359
+INFO 2025-08-30 16:30:25,448 basehttp 50146 13321187328 "GET /en/htmx/tenant-info/ HTTP/1.1" 200 1043
+INFO 2025-08-30 16:30:25,448 basehttp 50146 13304360960 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:30:35,355 basehttp 50146 13304360960 "GET / HTTP/1.1" 302 0
+INFO 2025-08-30 16:30:35,364 basehttp 50146 13321187328 "GET /en/ HTTP/1.1" 200 47446
+INFO 2025-08-30 16:30:35,421 basehttp 50146 13338013696 "GET /en/htmx/system-health/ HTTP/1.1" 200 1359
+INFO 2025-08-30 16:30:35,422 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:30:35,423 basehttp 50146 13304360960 "GET /en/htmx/tenant-info/ HTTP/1.1" 200 1043
+INFO 2025-08-30 16:30:35,423 basehttp 50146 6168834048 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:30:41,529 basehttp 50146 6168834048 "GET /en/ HTTP/1.1" 200 47446
+INFO 2025-08-30 16:30:41,589 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:30:41,594 basehttp 50146 13338013696 "GET /en/htmx/tenant-info/ HTTP/1.1" 200 1043
+INFO 2025-08-30 16:30:41,596 basehttp 50146 13321187328 "GET /en/htmx/system-health/ HTTP/1.1" 200 1359
+INFO 2025-08-30 16:30:41,597 basehttp 50146 13304360960 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:31:11,584 basehttp 50146 13304360960 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:31:41,605 basehttp 50146 13304360960 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:31:41,605 basehttp 50146 13321187328 "GET /en/htmx/system-health/ HTTP/1.1" 200 1359
+INFO 2025-08-30 16:31:41,606 basehttp 50146 13338013696 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:33:53,414 basehttp 50146 6168834048 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:36:13,958 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:36:13,960 basehttp 50146 13304360960 "GET /en/htmx/system-health/ HTTP/1.1" 200 1359
+INFO 2025-08-30 16:36:13,961 basehttp 50146 13321187328 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:36:43,944 basehttp 50146 13321187328 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:37:13,919 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:37:13,928 basehttp 50146 13321187328 "GET /en/htmx/system-health/ HTTP/1.1" 200 1359
+INFO 2025-08-30 16:37:13,936 basehttp 50146 13321187328 "GET /en/htmx/dashboard-stats/ HTTP/1.1" 200 2094
+INFO 2025-08-30 16:37:16,533 basehttp 50146 13321187328 "GET /en/inpatients/ HTTP/1.1" 200 41779
+INFO 2025-08-30 16:37:16,615 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:37:16,617 basehttp 50146 13304360960 "GET /en/inpatients/stats/ HTTP/1.1" 200 3000
+INFO 2025-08-30 16:37:16,638 basehttp 50146 6168834048 "GET /en/inpatients/bed-grid/ HTTP/1.1" 200 611361
+INFO 2025-08-30 16:37:19,618 basehttp 50146 6168834048 "GET /en/inventory HTTP/1.1" 301 0
+INFO 2025-08-30 16:37:19,634 basehttp 50146 13304360960 "GET /en/inventory/ HTTP/1.1" 200 46616
+INFO 2025-08-30 16:37:19,673 basehttp 50146 13304360960 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:37:19,677 basehttp 50146 13321187328 "GET /en/inventory/htmx/stats/ HTTP/1.1" 200 6394
+INFO 2025-08-30 16:37:49,679 basehttp 50146 13321187328 "GET /en/inventory/htmx/stats/ HTTP/1.1" 200 6394
+INFO 2025-08-30 16:38:19,688 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:38:19,689 basehttp 50146 13304360960 "GET /en/inventory/htmx/stats/ HTTP/1.1" 200 6394
+INFO 2025-08-30 16:38:49,681 basehttp 50146 13304360960 "GET /en/inventory/htmx/stats/ HTTP/1.1" 200 6394
+INFO 2025-08-30 16:39:04,793 basehttp 50146 13304360960 "GET /en/inventory/stock/?stock_status=low HTTP/1.1" 200 148603
+INFO 2025-08-30 16:39:04,805 basehttp 50146 13321187328 "GET /static/plugins/datatables.net-responsive-bs5/css/responsive.bootstrap5.min.css HTTP/1.1" 200 6044
+INFO 2025-08-30 16:39:04,807 basehttp 50146 13304360960 "GET /static/plugins/datatables.net-bs5/css/dataTables.bootstrap5.min.css HTTP/1.1" 200 15096
+INFO 2025-08-30 16:39:04,807 basehttp 50146 13338013696 "GET /static/plugins/datatables.net-bs5/js/dataTables.bootstrap5.min.js HTTP/1.1" 200 1470
+INFO 2025-08-30 16:39:04,808 basehttp 50146 13354840064 "GET /static/plugins/datatables.net-responsive/js/dataTables.responsive.min.js HTTP/1.1" 200 16086
+INFO 2025-08-30 16:39:04,808 basehttp 50146 13371666432 "GET /static/plugins/datatables.net-responsive-bs5/js/responsive.bootstrap5.min.js HTTP/1.1" 200 1796
+INFO 2025-08-30 16:39:04,809 basehttp 50146 13321187328 "GET /static/plugins/dropzone/src/options.js HTTP/1.1" 200 23721
+INFO 2025-08-30 16:39:04,809 basehttp 50146 6168834048 "GET /static/plugins/datatables.net/js/dataTables.min.js HTTP/1.1" 200 95735
+INFO 2025-08-30 16:39:04,866 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:39:04,871 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:40:04,941 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:40:04,952 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:40:05,000 basehttp 50146 6168834048 "GET /en/inventory/stock/?stock_status=low HTTP/1.1" 200 148603
+INFO 2025-08-30 16:40:05,066 basehttp 50146 6168834048 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 16:40:05,071 basehttp 50146 13321187328 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+WARNING 2025-08-30 16:40:10,340 log 50146 13321187328 Not Found: /en/operating_theatre
+WARNING 2025-08-30 16:40:10,340 basehttp 50146 13321187328 "GET /en/operating_theatre HTTP/1.1" 404 29892
+INFO 2025-08-30 16:40:22,775 basehttp 50146 13321187328 "GET /en/operating-theatre HTTP/1.1" 301 0
+ERROR 2025-08-30 16:40:22,802 log 50146 6168834048 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 69, in get_context_data
+ 'cases_today': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'scheduled_start_time' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 16:40:22,804 basehttp 50146 6168834048 "GET /en/operating-theatre/ HTTP/1.1" 500 134834
+INFO 2025-08-30 16:41:39,410 autoreload 50146 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 16:41:39,733 autoreload 57729 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:27:27,644 autoreload 57729 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 17:27:27,953 autoreload 60112 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:27:28,502 log 60112 6134509568 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 69, in get_context_data
+ 'cases_today': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'scheduled_start_time' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:27:28,504 basehttp 60112 6134509568 "GET /en/operating-theatre/ HTTP/1.1" 500 134971
+INFO 2025-08-30 17:28:39,856 autoreload 60112 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 17:28:40,175 autoreload 60662 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:28:41,678 log 60662 6201831424 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 69, in get_context_data
+ 'cases_today': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'scheduled_start_time' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:28:41,681 basehttp 60662 6201831424 "GET /en/operating-theatre/ HTTP/1.1" 500 134971
+ERROR 2025-08-30 17:28:42,927 log 60662 6201831424 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 69, in get_context_data
+ 'cases_today': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'scheduled_start_time' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:28:42,928 basehttp 60662 6201831424 "GET /en/operating-theatre/ HTTP/1.1" 500 134971
+INFO 2025-08-30 17:29:08,398 autoreload 60662 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 17:29:08,705 autoreload 60902 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:29:08,954 log 60902 6164033536 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 69, in get_context_data
+ 'cases_today': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:29:08,956 basehttp 60902 6164033536 "GET /en/operating-theatre/ HTTP/1.1" 500 135563
+INFO 2025-08-30 17:31:16,168 autoreload 60902 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:31:16,511 autoreload 61853 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:32:04,309 autoreload 61853 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:32:04,643 autoreload 62247 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:32:35,818 autoreload 62247 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:32:36,135 autoreload 62491 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:33:14,581 autoreload 62491 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:33:14,906 autoreload 62738 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:33:46,091 autoreload 62738 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:33:46,419 autoreload 62976 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:34:15,473 autoreload 62976 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:34:15,792 autoreload 63213 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:35:24,119 autoreload 63213 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:35:24,473 autoreload 63770 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:36:01,842 autoreload 63770 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:36:02,196 autoreload 64012 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:36:30,276 autoreload 64012 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:36:30,601 autoreload 64250 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:37:42,969 autoreload 64250 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:37:43,281 autoreload 64794 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:38:20,648 autoreload 64794 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:38:20,980 autoreload 65041 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:38:54,254 autoreload 65041 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:38:54,579 autoreload 65277 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 17:39:28,835 autoreload 65277 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:39:29,197 autoreload 65591 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:39:30,296 log 65591 6170914816 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 69, in get_context_data
+ 'cases_today': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:39:30,298 basehttp 65591 6170914816 "GET /en/operating-theatre/ HTTP/1.1" 500 135563
+ERROR 2025-08-30 17:39:31,704 log 65591 6170914816 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 69, in get_context_data
+ 'cases_today': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:39:31,705 basehttp 65591 6170914816 "GET /en/operating-theatre/ HTTP/1.1" 500 135563
+INFO 2025-08-30 17:40:10,745 autoreload 65591 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/models.py changed, reloading.
+INFO 2025-08-30 17:40:11,083 autoreload 65900 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:40:11,792 log 65900 6164819968 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 73, in get_context_data
+ 'cases_in_progress': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:40:11,794 basehttp 65900 6164819968 "GET /en/operating-theatre/ HTTP/1.1" 500 135444
+ERROR 2025-08-30 17:40:12,675 log 65900 6164819968 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 73, in get_context_data
+ 'cases_in_progress': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:40:12,676 basehttp 65900 6164819968 "GET /en/operating-theatre/ HTTP/1.1" 500 135444
+INFO 2025-08-30 17:40:37,128 autoreload 65900 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 17:40:37,456 autoreload 66069 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:40:37,872 log 66069 6170046464 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 77, in get_context_data
+ 'cases_completed_today': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'actual_end_time' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:40:37,873 basehttp 66069 6170046464 "GET /en/operating-theatre/ HTTP/1.1" 500 135295
+INFO 2025-08-30 17:41:09,878 autoreload 66069 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 17:41:10,220 autoreload 66304 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:41:13,904 log 66304 6169407488 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 82, in get_context_data
+ 'emergency_cases_today': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'priority' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:41:13,906 basehttp 66304 6169407488 "GET /en/operating-theatre/ HTTP/1.1" 500 135942
+INFO 2025-08-30 17:54:40,108 autoreload 66304 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 17:54:40,411 autoreload 68826 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:54:41,268 log 68826 6203830272 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 87, in get_context_data
+ 'blocks_today': ORBlock.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: allocated_minutes, assistant_surgeons, block_id, block_type, created_at, created_by, created_by_id, date, end_time, id, notes, operating_room, operating_room_id, primary_surgeon, primary_surgeon_id, service, special_equipment, special_setup, start_time, status, surgical_cases, updated_at, used_minutes
+ERROR 2025-08-30 17:54:41,270 basehttp 68826 6203830272 "GET /en/operating-theatre/ HTTP/1.1" 500 133197
+INFO 2025-08-30 17:57:03,473 autoreload 68826 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 17:57:03,847 autoreload 69912 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:57:05,104 log 69912 13052751872 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 91, in get_context_data
+ 'equipment_in_use': EquipmentUsage.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'status' into field. Choices are: created_at, end_time, equipment_name, equipment_type, expiration_date, id, lot_number, manufacturer, model, notes, quantity_used, recorded_by, recorded_by_id, serial_number, start_time, sterilization_date, surgical_case, surgical_case_id, total_cost, unit_cost, unit_of_measure, updated_at, usage_id
+ERROR 2025-08-30 17:57:05,107 basehttp 69912 13052751872 "GET /en/operating-theatre/ HTTP/1.1" 500 132552
+ERROR 2025-08-30 17:57:06,626 log 69912 13052751872 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 91, in get_context_data
+ 'equipment_in_use': EquipmentUsage.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'status' into field. Choices are: created_at, end_time, equipment_name, equipment_type, expiration_date, id, lot_number, manufacturer, model, notes, quantity_used, recorded_by, recorded_by_id, serial_number, start_time, sterilization_date, surgical_case, surgical_case_id, total_cost, unit_cost, unit_of_measure, updated_at, usage_id
+ERROR 2025-08-30 17:57:06,627 basehttp 69912 13052751872 "GET /en/operating-theatre/ HTTP/1.1" 500 132552
+INFO 2025-08-30 17:58:44,799 autoreload 69912 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 17:58:45,106 autoreload 70626 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:58:46,061 log 70626 6190411776 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 95, in get_context_data
+ 'notes_pending': SurgicalNote.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: blood_transfusion, closure, complications, condition, created_at, disposition, drains, estimated_blood_loss, findings, follow_up, id, implants, indication, note_id, planned_procedure, postop_instructions, postoperative_diagnosis, preoperative_diagnosis, procedure_performed, signed_datetime, specimens, status, surgeon, surgeon_id, surgical_approach, surgical_case, surgical_case_id, technique, template_used, template_used_id, updated_at
+ERROR 2025-08-30 17:58:46,063 basehttp 70626 6190411776 "GET /en/operating-theatre/ HTTP/1.1" 500 133892
+INFO 2025-08-30 17:59:55,636 autoreload 70626 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 17:59:55,939 autoreload 71169 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 17:59:56,450 log 71169 6168227840 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 102, in get_context_data
+ context['recent_cases'] = SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 17:59:56,452 basehttp 71169 6168227840 "GET /en/operating-theatre/ HTTP/1.1" 500 134769
+INFO 2025-08-30 18:01:02,427 autoreload 71169 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:01:02,754 autoreload 71636 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 18:01:03,998 log 71636 6161346560 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 120, in get_context_data
+ ).annotate(
+ ^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1649, in annotate
+ return self._annotate(args, kwargs, select=True)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1701, in _annotate
+ clone.query.add_annotation(
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1218, in add_annotation
+ annotation = annotation.resolve_expression(self, allow_joins=True, reuse=None)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/aggregates.py", line 176, in resolve_expression
+ result = super().resolve_expression(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/aggregates.py", line 63, in resolve_expression
+ c = super().resolve_expression(query, allow_joins, reuse, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/expressions.py", line 300, in resolve_expression
+ expr.resolve_expression(query, allow_joins, reuse, summarize, for_save)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/expressions.py", line 902, in resolve_expression
+ return query.resolve_ref(self.name, allow_joins, reuse, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 2049, in resolve_ref
+ join_info = self.setup_joins(
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1900, in setup_joins
+ path, final_field, targets, rest = self.names_to_path(
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'surgical_cases' into field. Choices are: accepts_emergency, air_changes_per_hour, building, ceiling_height, cleaning_time, created_at, created_by, created_by_id, equipment_list, floor_number, has_c_arm, has_ct, has_mri, has_neuromonitoring, has_ultrasound, humidity_max, humidity_min, id, is_active, max_case_duration, or_blocks, positive_pressure, required_nurses, required_techs, room_id, room_name, room_number, room_size, room_type, special_features, status, supports_laparoscopic, supports_laser, supports_microscopy, supports_robotic, temperature_max, temperature_min, tenant, tenant_id, turnover_time, updated_at, wing
+ERROR 2025-08-30 18:01:04,001 basehttp 71636 6161346560 "GET /en/operating-theatre/ HTTP/1.1" 500 140891
+ERROR 2025-08-30 18:01:05,830 log 71636 6161346560 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 120, in get_context_data
+ ).annotate(
+ ^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1649, in annotate
+ return self._annotate(args, kwargs, select=True)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1701, in _annotate
+ clone.query.add_annotation(
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1218, in add_annotation
+ annotation = annotation.resolve_expression(self, allow_joins=True, reuse=None)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/aggregates.py", line 176, in resolve_expression
+ result = super().resolve_expression(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/aggregates.py", line 63, in resolve_expression
+ c = super().resolve_expression(query, allow_joins, reuse, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/expressions.py", line 300, in resolve_expression
+ expr.resolve_expression(query, allow_joins, reuse, summarize, for_save)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/expressions.py", line 902, in resolve_expression
+ return query.resolve_ref(self.name, allow_joins, reuse, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 2049, in resolve_ref
+ join_info = self.setup_joins(
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1900, in setup_joins
+ path, final_field, targets, rest = self.names_to_path(
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'surgical_cases' into field. Choices are: accepts_emergency, air_changes_per_hour, building, ceiling_height, cleaning_time, created_at, created_by, created_by_id, equipment_list, floor_number, has_c_arm, has_ct, has_mri, has_neuromonitoring, has_ultrasound, humidity_max, humidity_min, id, is_active, max_case_duration, or_blocks, positive_pressure, required_nurses, required_techs, room_id, room_name, room_number, room_size, room_type, special_features, status, supports_laparoscopic, supports_laser, supports_microscopy, supports_robotic, temperature_max, temperature_min, tenant, tenant_id, turnover_time, updated_at, wing
+ERROR 2025-08-30 18:01:05,832 basehttp 71636 6161346560 "GET /en/operating-theatre/ HTTP/1.1" 500 140891
+INFO 2025-08-30 18:03:07,552 autoreload 71636 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:03:07,877 autoreload 72572 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 18:03:08,631 log 72572 6122532864 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 228, in get
+ context = self.get_context_data(**kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 120, in get_context_data
+ ).annotate(
+ ^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1649, in annotate
+ return self._annotate(args, kwargs, select=True)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1701, in _annotate
+ clone.query.add_annotation(
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1218, in add_annotation
+ annotation = annotation.resolve_expression(self, allow_joins=True, reuse=None)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/aggregates.py", line 176, in resolve_expression
+ result = super().resolve_expression(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/aggregates.py", line 63, in resolve_expression
+ c = super().resolve_expression(query, allow_joins, reuse, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/expressions.py", line 300, in resolve_expression
+ expr.resolve_expression(query, allow_joins, reuse, summarize, for_save)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/expressions.py", line 902, in resolve_expression
+ return query.resolve_ref(self.name, allow_joins, reuse, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 2049, in resolve_ref
+ join_info = self.setup_joins(
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1900, in setup_joins
+ path, final_field, targets, rest = self.names_to_path(
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'or_block' into field. Choices are: accepts_emergency, air_changes_per_hour, building, ceiling_height, cleaning_time, created_at, created_by, created_by_id, equipment_list, floor_number, has_c_arm, has_ct, has_mri, has_neuromonitoring, has_ultrasound, humidity_max, humidity_min, id, is_active, max_case_duration, or_blocks, positive_pressure, required_nurses, required_techs, room_id, room_name, room_number, room_size, room_type, special_features, status, supports_laparoscopic, supports_laser, supports_microscopy, supports_robotic, temperature_max, temperature_min, tenant, tenant_id, turnover_time, updated_at, wing
+ERROR 2025-08-30 18:03:08,632 basehttp 72572 6122532864 "GET /en/operating-theatre/ HTTP/1.1" 500 141636
+INFO 2025-08-30 18:13:16,726 autoreload 72572 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:13:17,027 autoreload 77055 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 18:13:18,179 log 77055 6157430784 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 326, in render
+ if match:
+ ^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 398, in __bool__
+ self._fetch_all()
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1949, in _fetch_all
+ self._result_cache = list(self._iterable_class(self))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 91, in __iter__
+ results = compiler.execute_sql(
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1610, in execute_sql
+ sql, params = self.as_sql()
+ ^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 766, in as_sql
+ extra_select, order_by, group_by = self.pre_sql_setup(
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 85, in pre_sql_setup
+ self.setup_query(with_col_aliases=with_col_aliases)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 74, in setup_query
+ self.select, self.klass_info, self.annotation_col_map = self.get_select(
+ ^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 299, in get_select
+ related_klass_infos = self.get_related_selections(select, select_mask)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1396, in get_related_selections
+ raise FieldError(
+django.core.exceptions.FieldError: Invalid field name(s) given in select_related: 'operating_room'. Choices are: or_block, patient, primary_surgeon, anesthesiologist, circulating_nurse, scrub_nurse, encounter, admission, created_by, surgical_note
+ERROR 2025-08-30 18:13:18,182 basehttp 77055 6157430784 "GET /en/operating-theatre/ HTTP/1.1" 500 227801
+INFO 2025-08-30 18:14:05,005 autoreload 77055 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:14:05,341 autoreload 77374 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 18:14:06,606 log 77374 6158790656 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 326, in render
+ if match:
+ ^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 398, in __bool__
+ self._fetch_all()
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1949, in _fetch_all
+ self._result_cache = list(self._iterable_class(self))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 91, in __iter__
+ results = compiler.execute_sql(
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1610, in execute_sql
+ sql, params = self.as_sql()
+ ^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 766, in as_sql
+ extra_select, order_by, group_by = self.pre_sql_setup(
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 85, in pre_sql_setup
+ self.setup_query(with_col_aliases=with_col_aliases)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 74, in setup_query
+ self.select, self.klass_info, self.annotation_col_map = self.get_select(
+ ^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 299, in get_select
+ related_klass_infos = self.get_related_selections(select, select_mask)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1396, in get_related_selections
+ raise FieldError(
+django.core.exceptions.FieldError: Invalid field name(s) given in select_related: 'operating_room'. Choices are: or_block, patient, primary_surgeon, anesthesiologist, circulating_nurse, scrub_nurse, encounter, admission, created_by, surgical_note
+ERROR 2025-08-30 18:14:06,610 basehttp 77374 6158790656 "GET /en/operating-theatre/ HTTP/1.1" 500 227801
+ERROR 2025-08-30 18:14:10,142 log 77374 6158790656 Internal Server Error: /en/operating-theatre/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 326, in render
+ if match:
+ ^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 398, in __bool__
+ self._fetch_all()
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1949, in _fetch_all
+ self._result_cache = list(self._iterable_class(self))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 91, in __iter__
+ results = compiler.execute_sql(
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1610, in execute_sql
+ sql, params = self.as_sql()
+ ^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 766, in as_sql
+ extra_select, order_by, group_by = self.pre_sql_setup(
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 85, in pre_sql_setup
+ self.setup_query(with_col_aliases=with_col_aliases)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 74, in setup_query
+ self.select, self.klass_info, self.annotation_col_map = self.get_select(
+ ^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 299, in get_select
+ related_klass_infos = self.get_related_selections(select, select_mask)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1396, in get_related_selections
+ raise FieldError(
+django.core.exceptions.FieldError: Invalid field name(s) given in select_related: 'operating_room'. Choices are: or_block, patient, primary_surgeon, anesthesiologist, circulating_nurse, scrub_nurse, encounter, admission, created_by, surgical_note
+ERROR 2025-08-30 18:14:10,144 basehttp 77374 6158790656 "GET /en/operating-theatre/ HTTP/1.1" 500 227801
+INFO 2025-08-30 18:14:28,366 autoreload 77374 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:14:28,727 autoreload 77603 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 18:14:29,473 basehttp 77603 6198620160 "GET /en/operating-theatre/ HTTP/1.1" 200 34120
+INFO 2025-08-30 18:14:29,524 basehttp 77603 6198620160 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+ERROR 2025-08-30 18:14:29,536 log 77603 6215446528 Internal Server Error: /en/operating-theatre/htmx/stats/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/decorators.py", line 59, in _view_wrapper
+ return view_func(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 1115, in operating_theatre_stats
+ 'cases_in_progress': SurgicalCase.objects.filter(
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 18:14:29,538 basehttp 77603 6215446528 "GET /en/operating-theatre/htmx/stats/ HTTP/1.1" 500 121556
+INFO 2025-08-30 18:14:36,642 basehttp 77603 6215446528 "GET /en/operating-theatre/rooms/create/ HTTP/1.1" 200 48886
+INFO 2025-08-30 18:14:36,673 basehttp 77603 6215446528 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+ERROR 2025-08-30 18:14:49,391 log 77603 6215446528 Internal Server Error: /en/operating-theatre/cases/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/list.py", line 158, in get
+ self.object_list = self.get_queryset()
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 685, in get_queryset
+ queryset = SurgicalCase.objects.filter(tenant=self.request.user.tenant)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/manager.py", line 87, in manager_method
+ return getattr(self.get_queryset(), name)(*args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1493, in filter
+ return self._filter_or_exclude(False, args, kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1511, in _filter_or_exclude
+ clone._filter_or_exclude_inplace(negate, args, kwargs)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1518, in _filter_or_exclude_inplace
+ self._query.add_q(Q(*args, **kwargs))
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1646, in add_q
+ clause, _ = self._add_q(q_object, can_reuse)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1678, in _add_q
+ child_clause, needed_inner = self.build_filter(
+ ^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1526, in build_filter
+ lookups, parts, reffed_expression = self.solve_lookup_type(arg, summarize)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1333, in solve_lookup_type
+ _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'tenant' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 18:14:49,393 basehttp 77603 6215446528 "GET /en/operating-theatre/cases/ HTTP/1.1" 500 133531
+INFO 2025-08-30 18:15:12,586 autoreload 77603 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:15:12,911 autoreload 77923 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 18:15:13,572 log 77923 6169423872 Internal Server Error: /en/operating-theatre/cases/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/list.py", line 158, in get
+ self.object_list = self.get_queryset()
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 727, in get_queryset
+ ).order_by('-scheduled_start_time')
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1722, in order_by
+ obj.query.add_ordering(*field_names)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 2291, in add_ordering
+ self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'scheduled_start_time' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 18:15:13,574 basehttp 77923 6169423872 "GET /en/operating-theatre/cases/ HTTP/1.1" 500 105953
+INFO 2025-08-30 18:16:17,321 autoreload 77923 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:16:17,634 autoreload 78389 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 18:16:18,751 log 78389 6163132416 Internal Server Error: /en/operating-theatre/cases/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/list.py", line 158, in get
+ self.object_list = self.get_queryset()
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 728, in get_queryset
+ ).order_by('-scheduled_start_time')
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1722, in order_by
+ obj.query.add_ordering(*field_names)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 2291, in add_ordering
+ self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'scheduled_start_time' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 18:16:18,753 basehttp 78389 6163132416 "GET /en/operating-theatre/cases/ HTTP/1.1" 500 106151
+ERROR 2025-08-30 18:16:19,560 log 78389 6163132416 Internal Server Error: /en/operating-theatre/cases/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/list.py", line 158, in get
+ self.object_list = self.get_queryset()
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 728, in get_queryset
+ ).order_by('-scheduled_start_time')
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1722, in order_by
+ obj.query.add_ordering(*field_names)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 2291, in add_ordering
+ self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'scheduled_start_time' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 18:16:19,561 basehttp 78389 6163132416 "GET /en/operating-theatre/cases/ HTTP/1.1" 500 106151
+ERROR 2025-08-30 18:16:21,032 log 78389 6163132416 Internal Server Error: /en/operating-theatre/cases/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/list.py", line 158, in get
+ self.object_list = self.get_queryset()
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 728, in get_queryset
+ ).order_by('-scheduled_start_time')
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1722, in order_by
+ obj.query.add_ordering(*field_names)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 2291, in add_ordering
+ self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/query.py", line 1805, in names_to_path
+ raise FieldError(
+django.core.exceptions.FieldError: Cannot resolve keyword 'scheduled_start_time' into field. Choices are: actual_end, actual_start, admission, admission_id, anesthesia_type, anesthesiologist, anesthesiologist_id, approach, assistant_surgeons, blood_products, case_id, case_number, case_type, circulating_nurse, circulating_nurse_id, clinical_notes, complications, created_at, created_by, created_by_id, diagnosis, diagnosis_codes, encounter, encounter_id, equipment_usage, estimated_blood_loss, estimated_duration, id, implants, or_block, or_block_id, patient, patient_id, patient_position, primary_procedure, primary_surgeon, primary_surgeon_id, procedure_codes, scheduled_start, scrub_nurse, scrub_nurse_id, secondary_procedures, special_equipment, status, surgical_note, updated_at
+ERROR 2025-08-30 18:16:21,033 basehttp 78389 6163132416 "GET /en/operating-theatre/cases/ HTTP/1.1" 500 106151
+INFO 2025-08-30 18:16:31,294 autoreload 78389 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:16:31,646 autoreload 78471 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 18:16:32,454 log 78471 6205222912 Internal Server Error: /en/operating-theatre/cases/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/options.py", line 683, in get_field
+ return self.fields_map[field_name]
+ ~~~~~~~~~~~~~~~^^^^^^^^^^^^
+KeyError: 'priority'
+
+During handling of the above exception, another exception occurred:
+
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
+ response = wrapped_callback(request, *callback_args, **callback_kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 105, in view
+ return self.dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/contrib/auth/mixins.py", line 73, in dispatch
+ return super().dispatch(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/base.py", line 144, in dispatch
+ return handler(request, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/views/generic/list.py", line 178, in get
+ context = self.get_context_data()
+ ^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py", line 734, in get_context_data
+ 'priorities': SurgicalCase._meta.get_field('priority').choices,
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/options.py", line 685, in get_field
+ raise FieldDoesNotExist(
+django.core.exceptions.FieldDoesNotExist: SurgicalCase has no field named 'priority'
+ERROR 2025-08-30 18:16:32,455 basehttp 78471 6205222912 "GET /en/operating-theatre/cases/ HTTP/1.1" 500 94480
+INFO 2025-08-30 18:17:26,667 autoreload 78471 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:17:27,006 autoreload 78865 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 18:17:28,179 log 78865 6123696128 Internal Server Error: /en/operating-theatre/cases/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 326, in render
+ if match:
+ ^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 398, in __bool__
+ self._fetch_all()
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1949, in _fetch_all
+ self._result_cache = list(self._iterable_class(self))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 91, in __iter__
+ results = compiler.execute_sql(
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1610, in execute_sql
+ sql, params = self.as_sql()
+ ^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 766, in as_sql
+ extra_select, order_by, group_by = self.pre_sql_setup(
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 85, in pre_sql_setup
+ self.setup_query(with_col_aliases=with_col_aliases)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 74, in setup_query
+ self.select, self.klass_info, self.annotation_col_map = self.get_select(
+ ^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 299, in get_select
+ related_klass_infos = self.get_related_selections(select, select_mask)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1396, in get_related_selections
+ raise FieldError(
+django.core.exceptions.FieldError: Invalid field name(s) given in select_related: 'operating_room'. Choices are: or_block, patient, primary_surgeon, anesthesiologist, circulating_nurse, scrub_nurse, encounter, admission, created_by, surgical_note
+ERROR 2025-08-30 18:17:28,180 basehttp 78865 6123696128 "GET /en/operating-theatre/cases/ HTTP/1.1" 500 218336
+ERROR 2025-08-30 18:17:30,480 log 78865 6123696128 Internal Server Error: /en/operating-theatre/cases/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 326, in render
+ if match:
+ ^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 398, in __bool__
+ self._fetch_all()
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 1949, in _fetch_all
+ self._result_cache = list(self._iterable_class(self))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/query.py", line 91, in __iter__
+ results = compiler.execute_sql(
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1610, in execute_sql
+ sql, params = self.as_sql()
+ ^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 766, in as_sql
+ extra_select, order_by, group_by = self.pre_sql_setup(
+ ^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 85, in pre_sql_setup
+ self.setup_query(with_col_aliases=with_col_aliases)
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 74, in setup_query
+ self.select, self.klass_info, self.annotation_col_map = self.get_select(
+ ^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 299, in get_select
+ related_klass_infos = self.get_related_selections(select, select_mask)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1396, in get_related_selections
+ raise FieldError(
+django.core.exceptions.FieldError: Invalid field name(s) given in select_related: 'operating_room'. Choices are: or_block, patient, primary_surgeon, anesthesiologist, circulating_nurse, scrub_nurse, encounter, admission, created_by, surgical_note
+ERROR 2025-08-30 18:17:30,481 basehttp 78865 6123696128 "GET /en/operating-theatre/cases/ HTTP/1.1" 500 218336
+INFO 2025-08-30 18:17:56,293 autoreload 78865 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:17:56,614 autoreload 79101 8466948288 Watching for file changes with StatReloader
+INFO 2025-08-30 18:17:56,928 basehttp 79101 6192934912 "GET /en/operating-theatre/cases/ HTTP/1.1" 200 23266
+INFO 2025-08-30 18:17:56,983 basehttp 79101 6192934912 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+ERROR 2025-08-30 18:18:00,473 log 79101 6192934912 Internal Server Error: /en/operating-theatre/cases/create/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 90, in rendered_content
+ template = self.resolve_template(self.template_name)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 72, in resolve_template
+ return select_template(template, using=self.using)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader.py", line 47, in select_template
+ raise TemplateDoesNotExist(", ".join(template_name_list), chain=chain)
+django.template.exceptions.TemplateDoesNotExist: operating_theatre/surgical_case_form.html
+ERROR 2025-08-30 18:18:00,474 basehttp 79101 6192934912 "GET /en/operating-theatre/cases/create/ HTTP/1.1" 500 83448
+INFO 2025-08-30 18:19:04,251 autoreload 79101 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 18:19:04,594 autoreload 79646 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 19:18:54,365 log 79646 6158610432 Internal Server Error: /en/operating-theatre/cases/create/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 480, in render
+ url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/base.py", line 98, in reverse
+ resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 831, in _reverse_with_prefix
+ raise NoReverseMatch(msg)
+django.urls.exceptions.NoReverseMatch: Reverse for 'patient_info' not found. 'patient_info' is not a valid view function or pattern name.
+ERROR 2025-08-30 19:18:54,369 basehttp 79646 6158610432 "GET /en/operating-theatre/cases/create/ HTTP/1.1" 500 176242
+ERROR 2025-08-30 19:28:36,347 log 79646 6158610432 Internal Server Error: /en/operating-theatre/cases/create/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 480, in render
+ url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/base.py", line 98, in reverse
+ resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 831, in _reverse_with_prefix
+ raise NoReverseMatch(msg)
+django.urls.exceptions.NoReverseMatch: Reverse for 'patient_info' not found. 'patient_info' is not a valid view function or pattern name.
+ERROR 2025-08-30 19:28:36,350 basehttp 79646 6158610432 "GET /en/operating-theatre/cases/create/ HTTP/1.1" 500 176242
+ERROR 2025-08-30 19:28:37,547 log 79646 6158610432 Internal Server Error: /en/operating-theatre/cases/create/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 480, in render
+ url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/base.py", line 98, in reverse
+ resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 831, in _reverse_with_prefix
+ raise NoReverseMatch(msg)
+django.urls.exceptions.NoReverseMatch: Reverse for 'patient_info' not found. 'patient_info' is not a valid view function or pattern name.
+ERROR 2025-08-30 19:28:37,549 basehttp 79646 6158610432 "GET /en/operating-theatre/cases/create/ HTTP/1.1" 500 176242
+INFO 2025-08-30 19:29:30,001 autoreload 79646 8466948288 /Users/marwanalwali/manus_project/hospital_management_system_v4/operating_theatre/views.py changed, reloading.
+INFO 2025-08-30 19:29:30,421 autoreload 10819 8466948288 Watching for file changes with StatReloader
+ERROR 2025-08-30 19:31:02,849 log 10819 6193033216 Internal Server Error: /en/operating-theatre/cases/create/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 480, in render
+ url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/base.py", line 98, in reverse
+ resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 831, in _reverse_with_prefix
+ raise NoReverseMatch(msg)
+django.urls.exceptions.NoReverseMatch: Reverse for 'check_room_availability' not found. 'check_room_availability' is not a valid view function or pattern name.
+ERROR 2025-08-30 19:31:02,854 basehttp 10819 6193033216 "GET /en/operating-theatre/cases/create/ HTTP/1.1" 500 176201
+ERROR 2025-08-30 19:31:41,657 log 10819 6193033216 Internal Server Error: /en/operating-theatre/cases/create/
+Traceback (most recent call last):
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
+ response = get_response(request)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 220, in _get_response
+ response = response.render()
+ ^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 114, in render
+ self.content = self.rendered_content
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/response.py", line 92, in rendered_content
+ return template.render(context, self._request)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
+ return self.template.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 171, in render
+ return self._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
+ return compiled_parent._render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 163, in _render
+ return self.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
+ result = block.nodelist.render(context)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
+ return SafeString("".join([node.render_annotated(context) for node in self]))
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
+ return self.render(context)
+ ^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/template/defaulttags.py", line 480, in render
+ url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/base.py", line 98, in reverse
+ resolved_url = resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/Users/marwanalwali/manus_project/hospital_management_system_v4/.venv/lib/python3.12/site-packages/django/urls/resolvers.py", line 831, in _reverse_with_prefix
+ raise NoReverseMatch(msg)
+django.urls.exceptions.NoReverseMatch: Reverse for 'room_schedule' not found. 'room_schedule' is not a valid view function or pattern name.
+ERROR 2025-08-30 19:31:41,659 basehttp 10819 6193033216 "GET /en/operating-theatre/cases/create/ HTTP/1.1" 500 178005
+INFO 2025-08-30 19:31:59,288 basehttp 10819 6193033216 "GET /en/operating-theatre/cases/create/ HTTP/1.1" 200 43519
+INFO 2025-08-30 19:31:59,302 basehttp 10819 6209859584 "GET /static/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css HTTP/1.1" 200 3034
+INFO 2025-08-30 19:31:59,303 basehttp 10819 6193033216 "GET /static/plugins/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css HTTP/1.1" 200 15733
+INFO 2025-08-30 19:31:59,303 basehttp 10819 6226685952 "GET /static/plugins/select2/dist/css/select2.min.css HTTP/1.1" 200 14966
+INFO 2025-08-30 19:31:59,304 basehttp 10819 6243512320 "GET /static/plugins/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js HTTP/1.1" 200 33871
+INFO 2025-08-30 19:31:59,304 basehttp 10819 6260338688 "GET /static/plugins/bootstrap-timepicker/js/bootstrap-timepicker.min.js HTTP/1.1" 200 18685
+INFO 2025-08-30 19:31:59,305 basehttp 10819 6277165056 "GET /static/plugins/select2/dist/js/select2.min.js HTTP/1.1" 200 70851
+INFO 2025-08-30 19:31:59,337 basehttp 10819 6277165056 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
+INFO 2025-08-30 19:32:29,194 basehttp 10819 6277165056 "GET /en/operating-theatre/cases/ HTTP/1.1" 200 23266
+INFO 2025-08-30 19:32:29,228 basehttp 10819 6277165056 "GET /en/htmx/system-notifications/ HTTP/1.1" 200 3836
diff --git a/operating_theatre/__pycache__/models.cpython-312.pyc b/operating_theatre/__pycache__/models.cpython-312.pyc
index 69cc8605..f1014383 100644
Binary files a/operating_theatre/__pycache__/models.cpython-312.pyc and b/operating_theatre/__pycache__/models.cpython-312.pyc differ
diff --git a/operating_theatre/__pycache__/views.cpython-312.pyc b/operating_theatre/__pycache__/views.cpython-312.pyc
index cc3bcbbc..ec00a43e 100644
Binary files a/operating_theatre/__pycache__/views.cpython-312.pyc and b/operating_theatre/__pycache__/views.cpython-312.pyc differ
diff --git a/operating_theatre/models.py b/operating_theatre/models.py
index c2940397..c7de9820 100644
--- a/operating_theatre/models.py
+++ b/operating_theatre/models.py
@@ -17,7 +17,37 @@ class OperatingRoom(models.Model):
"""
Operating room model for OR configuration and management.
"""
-
+ ROOM_TYPE_CHOICES = [
+ ('GENERAL', 'General Surgery'),
+ ('CARDIAC', 'Cardiac Surgery'),
+ ('NEURO', 'Neurosurgery'),
+ ('ORTHOPEDIC', 'Orthopedic Surgery'),
+ ('TRAUMA', 'Trauma Surgery'),
+ ('PEDIATRIC', 'Pediatric Surgery'),
+ ('OBSTETRIC', 'Obstetric Surgery'),
+ ('OPHTHALMOLOGY', 'Ophthalmology'),
+ ('ENT', 'ENT Surgery'),
+ ('UROLOGY', 'Urology'),
+ ('PLASTIC', 'Plastic Surgery'),
+ ('VASCULAR', 'Vascular Surgery'),
+ ('THORACIC', 'Thoracic Surgery'),
+ ('TRANSPLANT', 'Transplant Surgery'),
+ ('ROBOTIC', 'Robotic Surgery'),
+ ('HYBRID', 'Hybrid OR'),
+ ('AMBULATORY', 'Ambulatory Surgery'),
+ ('EMERGENCY', 'Emergency Surgery'),
+ ]
+ STATUS_CHOICES = [
+ ('AVAILABLE', 'Available'),
+ ('OCCUPIED', 'Occupied'),
+ ('CLEANING', 'Cleaning'),
+ ('MAINTENANCE', 'Maintenance'),
+ ('SETUP', 'Setup'),
+ ('TURNOVER', 'Turnover'),
+ ('OUT_OF_ORDER', 'Out of Order'),
+ ('CLOSED', 'Closed'),
+ ]
+
# Tenant relationship
tenant = models.ForeignKey(
'core.Tenant',
@@ -45,42 +75,14 @@ class OperatingRoom(models.Model):
# Room Type and Capabilities
room_type = models.CharField(
max_length=30,
- choices=[
- ('GENERAL', 'General Surgery'),
- ('CARDIAC', 'Cardiac Surgery'),
- ('NEURO', 'Neurosurgery'),
- ('ORTHOPEDIC', 'Orthopedic Surgery'),
- ('TRAUMA', 'Trauma Surgery'),
- ('PEDIATRIC', 'Pediatric Surgery'),
- ('OBSTETRIC', 'Obstetric Surgery'),
- ('OPHTHALMOLOGY', 'Ophthalmology'),
- ('ENT', 'ENT Surgery'),
- ('UROLOGY', 'Urology'),
- ('PLASTIC', 'Plastic Surgery'),
- ('VASCULAR', 'Vascular Surgery'),
- ('THORACIC', 'Thoracic Surgery'),
- ('TRANSPLANT', 'Transplant Surgery'),
- ('ROBOTIC', 'Robotic Surgery'),
- ('HYBRID', 'Hybrid OR'),
- ('AMBULATORY', 'Ambulatory Surgery'),
- ('EMERGENCY', 'Emergency Surgery'),
- ],
+ choices=ROOM_TYPE_CHOICES,
help_text='Operating room type'
)
# Room Status
status = models.CharField(
max_length=20,
- choices=[
- ('AVAILABLE', 'Available'),
- ('OCCUPIED', 'Occupied'),
- ('CLEANING', 'Cleaning'),
- ('MAINTENANCE', 'Maintenance'),
- ('SETUP', 'Setup'),
- ('TURNOVER', 'Turnover'),
- ('OUT_OF_ORDER', 'Out of Order'),
- ('CLOSED', 'Closed'),
- ],
+ choices=STATUS_CHOICES,
default='AVAILABLE',
help_text='Current room status'
)
@@ -275,7 +277,38 @@ class ORBlock(models.Model):
"""
OR block model for surgical scheduling and time management.
"""
-
+ BLOCK_TYPE_CHOICES = [
+ ('SCHEDULED', 'Scheduled Block'),
+ ('EMERGENCY', 'Emergency Block'),
+ ('MAINTENANCE', 'Maintenance Block'),
+ ('CLEANING', 'Deep Cleaning'),
+ ('RESERVED', 'Reserved'),
+ ('BLOCKED', 'Blocked'),
+ ]
+ SERVICE_CHOICES = [
+ ('GENERAL', 'General Surgery'),
+ ('CARDIAC', 'Cardiac Surgery'),
+ ('NEURO', 'Neurosurgery'),
+ ('ORTHOPEDIC', 'Orthopedic Surgery'),
+ ('TRAUMA', 'Trauma Surgery'),
+ ('PEDIATRIC', 'Pediatric Surgery'),
+ ('OBSTETRIC', 'Obstetric Surgery'),
+ ('OPHTHALMOLOGY', 'Ophthalmology'),
+ ('ENT', 'ENT Surgery'),
+ ('UROLOGY', 'Urology'),
+ ('PLASTIC', 'Plastic Surgery'),
+ ('VASCULAR', 'Vascular Surgery'),
+ ('THORACIC', 'Thoracic Surgery'),
+ ('TRANSPLANT', 'Transplant Surgery'),
+ ]
+ STATUS_CHOICES = [
+ ('SCHEDULED', 'Scheduled'),
+ ('ACTIVE', 'Active'),
+ ('COMPLETED', 'Completed'),
+ ('CANCELLED', 'Cancelled'),
+ ('DELAYED', 'Delayed'),
+ ]
+
# Operating Room relationship
operating_room = models.ForeignKey(
OperatingRoom,
@@ -306,14 +339,7 @@ class ORBlock(models.Model):
# Block Type
block_type = models.CharField(
max_length=20,
- choices=[
- ('SCHEDULED', 'Scheduled Block'),
- ('EMERGENCY', 'Emergency Block'),
- ('MAINTENANCE', 'Maintenance Block'),
- ('CLEANING', 'Deep Cleaning'),
- ('RESERVED', 'Reserved'),
- ('BLOCKED', 'Blocked'),
- ],
+ choices=BLOCK_TYPE_CHOICES,
default='SCHEDULED',
help_text='Block type'
)
@@ -335,35 +361,14 @@ class ORBlock(models.Model):
# Service Assignment
service = models.CharField(
max_length=30,
- choices=[
- ('GENERAL', 'General Surgery'),
- ('CARDIAC', 'Cardiac Surgery'),
- ('NEURO', 'Neurosurgery'),
- ('ORTHOPEDIC', 'Orthopedic Surgery'),
- ('TRAUMA', 'Trauma Surgery'),
- ('PEDIATRIC', 'Pediatric Surgery'),
- ('OBSTETRIC', 'Obstetric Surgery'),
- ('OPHTHALMOLOGY', 'Ophthalmology'),
- ('ENT', 'ENT Surgery'),
- ('UROLOGY', 'Urology'),
- ('PLASTIC', 'Plastic Surgery'),
- ('VASCULAR', 'Vascular Surgery'),
- ('THORACIC', 'Thoracic Surgery'),
- ('TRANSPLANT', 'Transplant Surgery'),
- ],
+ choices=SERVICE_CHOICES,
help_text='Surgical service'
)
# Block Status
status = models.CharField(
max_length=20,
- choices=[
- ('SCHEDULED', 'Scheduled'),
- ('ACTIVE', 'Active'),
- ('COMPLETED', 'Completed'),
- ('CANCELLED', 'Cancelled'),
- ('DELAYED', 'Delayed'),
- ],
+ choices=STATUS_CHOICES,
default='SCHEDULED',
help_text='Block status'
)
@@ -457,7 +462,49 @@ class SurgicalCase(models.Model):
"""
Surgical case model for individual surgical procedures.
"""
-
+ CASE_TYPE_CHOICES = [
+ ('ELECTIVE', 'Elective'),
+ ('URGENT', 'Urgent'),
+ ('EMERGENCY', 'Emergency'),
+ ('TRAUMA', 'Trauma'),
+ ('TRANSPLANT', 'Transplant'),
+ ]
+ APPROACH_CHOICES = [
+ ('OPEN', 'Open'),
+ ('LAPAROSCOPIC', 'Laparoscopic'),
+ ('ROBOTIC', 'Robotic'),
+ ('ENDOSCOPIC', 'Endoscopic'),
+ ('PERCUTANEOUS', 'Percutaneous'),
+ ('HYBRID', 'Hybrid'),
+ ]
+ ANESTHESIA_TYPE_CHOICES = [
+ ('GENERAL', 'General'),
+ ('REGIONAL', 'Regional'),
+ ('LOCAL', 'Local'),
+ ('SEDATION', 'Sedation'),
+ ('SPINAL', 'Spinal'),
+ ('EPIDURAL', 'Epidural'),
+ ('COMBINED', 'Combined'),
+ ]
+ STATUS_CHOICES = [
+ ('SCHEDULED', 'Scheduled'),
+ ('DELAYED', 'Delayed'),
+ ('IN_PROGRESS', 'In Progress'),
+ ('COMPLETED', 'Completed'),
+ ('CANCELLED', 'Cancelled'),
+ ('POSTPONED', 'Postponed'),
+ ]
+ PATIENT_POSITION_CHOICES = [
+ ('SUPINE', 'Supine'),
+ ('PRONE', 'Prone'),
+ ('LATERAL', 'Lateral'),
+ ('LITHOTOMY', 'Lithotomy'),
+ ('TRENDELENBURG', 'Trendelenburg'),
+ ('REVERSE_TREND', 'Reverse Trendelenburg'),
+ ('SITTING', 'Sitting'),
+ ('JACKKNIFE', 'Jackknife'),
+ ]
+
# OR Block relationship
or_block = models.ForeignKey(
ORBlock,
@@ -542,13 +589,7 @@ class SurgicalCase(models.Model):
# Case Classification
case_type = models.CharField(
max_length=20,
- choices=[
- ('ELECTIVE', 'Elective'),
- ('URGENT', 'Urgent'),
- ('EMERGENCY', 'Emergency'),
- ('TRAUMA', 'Trauma'),
- ('TRANSPLANT', 'Transplant'),
- ],
+ choices=CASE_TYPE_CHOICES,
default='ELECTIVE',
help_text='Case type'
)
@@ -556,29 +597,14 @@ class SurgicalCase(models.Model):
# Surgical Approach
approach = models.CharField(
max_length=20,
- choices=[
- ('OPEN', 'Open'),
- ('LAPAROSCOPIC', 'Laparoscopic'),
- ('ROBOTIC', 'Robotic'),
- ('ENDOSCOPIC', 'Endoscopic'),
- ('PERCUTANEOUS', 'Percutaneous'),
- ('HYBRID', 'Hybrid'),
- ],
+ choices=APPROACH_CHOICES,
help_text='Surgical approach'
)
# Anesthesia
anesthesia_type = models.CharField(
max_length=20,
- choices=[
- ('GENERAL', 'General'),
- ('REGIONAL', 'Regional'),
- ('LOCAL', 'Local'),
- ('SEDATION', 'Sedation'),
- ('SPINAL', 'Spinal'),
- ('EPIDURAL', 'Epidural'),
- ('COMBINED', 'Combined'),
- ],
+ choices=ANESTHESIA_TYPE_CHOICES,
help_text='Anesthesia type'
)
@@ -603,14 +629,7 @@ class SurgicalCase(models.Model):
# Case Status
status = models.CharField(
max_length=20,
- choices=[
- ('SCHEDULED', 'Scheduled'),
- ('DELAYED', 'Delayed'),
- ('IN_PROGRESS', 'In Progress'),
- ('COMPLETED', 'Completed'),
- ('CANCELLED', 'Cancelled'),
- ('POSTPONED', 'Postponed'),
- ],
+ choices=STATUS_CHOICES,
default='SCHEDULED',
help_text='Case status'
)
@@ -647,16 +666,7 @@ class SurgicalCase(models.Model):
# Patient Positioning
patient_position = models.CharField(
max_length=20,
- choices=[
- ('SUPINE', 'Supine'),
- ('PRONE', 'Prone'),
- ('LATERAL', 'Lateral'),
- ('LITHOTOMY', 'Lithotomy'),
- ('TRENDELENBURG', 'Trendelenburg'),
- ('REVERSE_TREND', 'Reverse Trendelenburg'),
- ('SITTING', 'Sitting'),
- ('JACKKNIFE', 'Jackknife'),
- ],
+ choices=PATIENT_POSITION_CHOICES,
blank=True,
null=True,
help_text='Patient positioning'
@@ -777,7 +787,27 @@ class SurgicalNote(models.Model):
"""
Surgical note model for perioperative documentation.
"""
-
+ CONDITION_CHOICES = [
+ ('STABLE', 'Stable'),
+ ('CRITICAL', 'Critical'),
+ ('GUARDED', 'Guarded'),
+ ('FAIR', 'Fair'),
+ ('GOOD', 'Good'),
+ ('EXCELLENT', 'Excellent'),
+ ]
+ DISPOSITION_CHOICES = [
+ ('RECOVERY', 'Recovery Room'),
+ ('ICU', 'Intensive Care Unit'),
+ ('WARD', 'Ward'),
+ ('DISCHARGE', 'Discharge'),
+ ('MORGUE', 'Morgue'),
+ ]
+ STATUS_CHOICES = [
+ ('DRAFT', 'Draft'),
+ ('COMPLETED', 'Completed'),
+ ('SIGNED', 'Signed'),
+ ('AMENDED', 'Amended'),
+ ]
# Surgical Case relationship
surgical_case = models.OneToOneField(
SurgicalCase,
@@ -833,25 +863,12 @@ class SurgicalNote(models.Model):
)
condition = models.CharField(
max_length=20,
- choices=[
- ('STABLE', 'Stable'),
- ('CRITICAL', 'Critical'),
- ('GUARDED', 'Guarded'),
- ('FAIR', 'Fair'),
- ('GOOD', 'Good'),
- ('EXCELLENT', 'Excellent'),
- ],
+ choices=CONDITION_CHOICES,
help_text='Patient condition post-surgery'
)
disposition = models.CharField(
max_length=30,
- choices=[
- ('RECOVERY', 'Recovery Room'),
- ('ICU', 'Intensive Care Unit'),
- ('WARD', 'Ward'),
- ('DISCHARGE', 'Discharge'),
- ('MORGUE', 'Morgue'),
- ],
+ choices=DISPOSITION_CHOICES,
help_text='Patient disposition'
)
@@ -915,12 +932,7 @@ class SurgicalNote(models.Model):
# Note Status
status = models.CharField(
max_length=20,
- choices=[
- ('DRAFT', 'Draft'),
- ('COMPLETED', 'Completed'),
- ('SIGNED', 'Signed'),
- ('AMENDED', 'Amended'),
- ],
+ choices=STATUS_CHOICES,
default='DRAFT',
help_text='Note status'
)
@@ -980,7 +992,30 @@ class EquipmentUsage(models.Model):
"""
Equipment usage model for tracking surgical equipment.
"""
-
+ EQUIPMENT_TYPE_CHOICES = [
+ ('SURGICAL_INSTRUMENT', 'Surgical Instrument'),
+ ('MONITORING_DEVICE', 'Monitoring Device'),
+ ('ANESTHESIA_MACHINE', 'Anesthesia Machine'),
+ ('VENTILATOR', 'Ventilator'),
+ ('ELECTROCAUTERY', 'Electrocautery'),
+ ('LASER', 'Laser'),
+ ('MICROSCOPE', 'Microscope'),
+ ('C_ARM', 'C-Arm'),
+ ('ULTRASOUND', 'Ultrasound'),
+ ('ROBOT', 'Surgical Robot'),
+ ('IMPLANT', 'Implant'),
+ ('DISPOSABLE', 'Disposable'),
+ ('OTHER', 'Other'),
+ ]
+ UNIT_OF_MEASURE_CHOICES = [
+ ('EACH', 'Each'),
+ ('SET', 'Set'),
+ ('PACK', 'Pack'),
+ ('BOX', 'Box'),
+ ('UNIT', 'Unit'),
+ ('PIECE', 'Piece'),
+ ]
+
# Surgical Case relationship
surgical_case = models.ForeignKey(
SurgicalCase,
@@ -1002,21 +1037,7 @@ class EquipmentUsage(models.Model):
)
equipment_type = models.CharField(
max_length=50,
- choices=[
- ('SURGICAL_INSTRUMENT', 'Surgical Instrument'),
- ('MONITORING_DEVICE', 'Monitoring Device'),
- ('ANESTHESIA_MACHINE', 'Anesthesia Machine'),
- ('VENTILATOR', 'Ventilator'),
- ('ELECTROCAUTERY', 'Electrocautery'),
- ('LASER', 'Laser'),
- ('MICROSCOPE', 'Microscope'),
- ('C_ARM', 'C-Arm'),
- ('ULTRASOUND', 'Ultrasound'),
- ('ROBOT', 'Surgical Robot'),
- ('IMPLANT', 'Implant'),
- ('DISPOSABLE', 'Disposable'),
- ('OTHER', 'Other'),
- ],
+ choices=EQUIPMENT_TYPE_CHOICES,
help_text='Equipment type'
)
@@ -1047,14 +1068,7 @@ class EquipmentUsage(models.Model):
)
unit_of_measure = models.CharField(
max_length=20,
- choices=[
- ('EACH', 'Each'),
- ('SET', 'Set'),
- ('PACK', 'Pack'),
- ('BOX', 'Box'),
- ('UNIT', 'Unit'),
- ('PIECE', 'Piece'),
- ],
+ choices=UNIT_OF_MEASURE_CHOICES,
default='EACH',
help_text='Unit of measure'
)
@@ -1172,7 +1186,24 @@ class SurgicalNoteTemplate(models.Model):
"""
Surgical note template model for standardized documentation.
"""
-
+ SPECIALTY_CHOICES = [
+ ('ALL', 'All Specialties'),
+ ('GENERAL', 'General Surgery'),
+ ('CARDIAC', 'Cardiac Surgery'),
+ ('NEURO', 'Neurosurgery'),
+ ('ORTHOPEDIC', 'Orthopedic Surgery'),
+ ('TRAUMA', 'Trauma Surgery'),
+ ('PEDIATRIC', 'Pediatric Surgery'),
+ ('OBSTETRIC', 'Obstetric Surgery'),
+ ('OPHTHALMOLOGY', 'Ophthalmology'),
+ ('ENT', 'ENT Surgery'),
+ ('UROLOGY', 'Urology'),
+ ('PLASTIC', 'Plastic Surgery'),
+ ('VASCULAR', 'Vascular Surgery'),
+ ('THORACIC', 'Thoracic Surgery'),
+ ('TRANSPLANT', 'Transplant Surgery'),
+ ]
+
# Tenant relationship
tenant = models.ForeignKey(
'core.Tenant',
@@ -1207,23 +1238,7 @@ class SurgicalNoteTemplate(models.Model):
)
specialty = models.CharField(
max_length=30,
- choices=[
- ('ALL', 'All Specialties'),
- ('GENERAL', 'General Surgery'),
- ('CARDIAC', 'Cardiac Surgery'),
- ('NEURO', 'Neurosurgery'),
- ('ORTHOPEDIC', 'Orthopedic Surgery'),
- ('TRAUMA', 'Trauma Surgery'),
- ('PEDIATRIC', 'Pediatric Surgery'),
- ('OBSTETRIC', 'Obstetric Surgery'),
- ('OPHTHALMOLOGY', 'Ophthalmology'),
- ('ENT', 'ENT Surgery'),
- ('UROLOGY', 'Urology'),
- ('PLASTIC', 'Plastic Surgery'),
- ('VASCULAR', 'Vascular Surgery'),
- ('THORACIC', 'Thoracic Surgery'),
- ('TRANSPLANT', 'Transplant Surgery'),
- ],
+ choices=SPECIALTY_CHOICES,
default='ALL',
help_text='Applicable specialty'
)
diff --git a/operating_theatre/views.py b/operating_theatre/views.py
index d1ec28e9..ee689bef 100644
--- a/operating_theatre/views.py
+++ b/operating_theatre/views.py
@@ -67,62 +67,62 @@ class OperatingTheatreDashboardView(LoginRequiredMixin, TemplateView):
status='MAINTENANCE'
).count(),
'cases_today': SurgicalCase.objects.filter(
- tenant=tenant,
- scheduled_start_time__date=today
+ admission__tenant=tenant,
+ scheduled_start__date=today
).count(),
'cases_in_progress': SurgicalCase.objects.filter(
- tenant=tenant,
+ admission__tenant=tenant,
status='IN_PROGRESS'
).count(),
'cases_completed_today': SurgicalCase.objects.filter(
- tenant=tenant,
- actual_end_time__date=today,
+ admission__tenant=tenant,
+ actual_end__date=today,
status='COMPLETED'
).count(),
'emergency_cases_today': SurgicalCase.objects.filter(
- tenant=tenant,
- scheduled_start_time__date=today,
- priority='EMERGENCY'
+ admission__tenant=tenant,
+ scheduled_start__date=today,
+ case_type='EMERGENCY'
).count(),
'blocks_today': ORBlock.objects.filter(
- tenant=tenant,
+ operating_room__tenant=tenant,
date=today
).count(),
'equipment_in_use': EquipmentUsage.objects.filter(
- tenant=tenant,
- status='IN_USE'
+ surgical_case__admission__tenant=tenant,
+ # status='IN_USE'
).count(),
'notes_pending': SurgicalNote.objects.filter(
- tenant=tenant,
+ surgical_case__admission__tenant=tenant,
status='DRAFT'
).count(),
})
# Recent surgical cases
context['recent_cases'] = SurgicalCase.objects.filter(
- tenant=tenant
+ admission__tenant=tenant
).select_related(
- 'patient', 'primary_surgeon', 'operating_room'
- ).order_by('-scheduled_start_time')[:10]
+ 'patient', 'primary_surgeon', 'or_block__operating_room'
+ ).order_by('-scheduled_start')[:10]
# Today's schedule
context['todays_schedule'] = SurgicalCase.objects.filter(
- tenant=tenant,
- scheduled_start_time__date=today
+ admission__tenant=tenant,
+ scheduled_start__date=today
).select_related(
- 'patient', 'primary_surgeon', 'operating_room'
- ).order_by('scheduled_start_time')
+ 'patient', 'primary_surgeon', 'or_block__operating_room'
+ ).order_by('scheduled_start')
# Room utilization
- context['room_utilization'] = OperatingRoom.objects.filter(
- tenant=tenant,
- is_active=True
- ).annotate(
- cases_today=Count(
- 'surgical_cases',
- filter=Q(surgical_cases__scheduled_start_time__date=today)
- )
- ).order_by('room_number')
+ # context['room_utilization'] = OperatingRoom.objects.filter(
+ # tenant=tenant,
+ # is_active=True
+ # ).annotate(
+ # cases_today=Count(
+ # 'or_block__surgical_cases',
+ # filter=Q(surgical_cases__scheduled_start__date=today)
+ # )
+ # ).order_by('room_number')
return context
@@ -136,7 +136,7 @@ class OperatingRoomListView(LoginRequiredMixin, ListView):
List all operating rooms with filtering and search.
"""
model = OperatingRoom
- template_name = 'operating_theatre/operating_room_list.html'
+ template_name = 'operating_theatre/rooms/operating_room_list.html'
context_object_name = 'operating_rooms'
paginate_by = 25
@@ -189,7 +189,7 @@ class OperatingRoomDetailView(LoginRequiredMixin, DetailView):
Display detailed information about an operating room.
"""
model = OperatingRoom
- template_name = 'operating_theatre/operating_room_detail.html'
+ template_name = 'operating_theatre/rooms/operating_room_detail.html'
context_object_name = 'operating_room'
def get_queryset(self):
@@ -241,7 +241,7 @@ class OperatingRoomCreateView(LoginRequiredMixin, PermissionRequiredMixin, Creat
"""
model = OperatingRoom
form_class = OperatingRoomForm
- template_name = 'operating_theatre/operating_room_form.html'
+ template_name = 'operating_theatre/rooms/operating_room_form.html'
permission_required = 'operating_theatre.add_operatingroom'
success_url = reverse_lazy('operating_theatre:operating_room_list')
@@ -272,7 +272,7 @@ class OperatingRoomUpdateView(LoginRequiredMixin, PermissionRequiredMixin, Updat
"""
model = OperatingRoom
form_class = OperatingRoomForm
- template_name = 'operating_theatre/operating_room_form.html'
+ template_name = 'operating_theatre/rooms/operating_room_form.html'
permission_required = 'operating_theatre.change_operatingroom'
def get_queryset(self):
@@ -305,7 +305,7 @@ class OperatingRoomDeleteView(LoginRequiredMixin, PermissionRequiredMixin, Delet
Delete an operating room (soft delete by deactivating).
"""
model = OperatingRoom
- template_name = 'operating_theatre/operating_room_confirm_delete.html'
+ template_name = 'operating_theatre/rooms/operating_room_confirm_delete.html'
permission_required = 'operating_theatre.delete_operatingroom'
success_url = reverse_lazy('operating_theatre:operating_room_list')
@@ -333,7 +333,7 @@ class OperatingRoomDeleteView(LoginRequiredMixin, PermissionRequiredMixin, Delet
self.object.save()
# Log the action
- AuditLogger.log_action(
+ AuditLogger.log_event(
user=request.user,
action='OPERATING_ROOM_DEACTIVATED',
model='OperatingRoom',
@@ -431,7 +431,7 @@ class SurgicalNoteTemplateCreateView(LoginRequiredMixin, PermissionRequiredMixin
response = super().form_valid(form)
# Log the action
- AuditLogger.log_action(
+ AuditLogger.log_event(
user=self.request.user,
action='SURGICAL_NOTE_TEMPLATE_CREATED',
model='SurgicalNoteTemplate',
@@ -682,7 +682,8 @@ class SurgicalCaseListView(LoginRequiredMixin, ListView):
paginate_by = 25
def get_queryset(self):
- queryset = SurgicalCase.objects.filter(tenant=self.request.user.tenant)
+ tenant = self.request.user.tenant
+ queryset = SurgicalCase.objects.filter(admission__tenant=tenant)
# Search functionality
search = self.request.GET.get('search')
@@ -718,19 +719,19 @@ class SurgicalCaseListView(LoginRequiredMixin, ListView):
date_from = self.request.GET.get('date_from')
date_to = self.request.GET.get('date_to')
if date_from:
- queryset = queryset.filter(scheduled_start_time__date__gte=date_from)
+ queryset = queryset.filter(scheduled_start__date__gte=date_from)
if date_to:
- queryset = queryset.filter(scheduled_start_time__date__lte=date_to)
+ queryset = queryset.filter(scheduled_start__date__lte=date_to)
return queryset.select_related(
- 'patient', 'primary_surgeon', 'operating_room'
- ).order_by('-scheduled_start_time')
+ 'patient', 'primary_surgeon', 'or_block__operating_room'
+ ).order_by('-scheduled_start')
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context.update({
- 'statuses': SurgicalCase._meta.get_field('status').choices,
- 'priorities': SurgicalCase._meta.get_field('priority').choices,
+ 'statuses': SurgicalCase.STATUS_CHOICES,
+ 'priorities': SurgicalCase.CASE_TYPE_CHOICES,
'operating_rooms': OperatingRoom.objects.filter(
tenant=self.request.user.tenant,
is_active=True
@@ -744,7 +745,7 @@ class SurgicalCaseDetailView(LoginRequiredMixin, DetailView):
Display detailed information about a surgical case.
"""
model = SurgicalCase
- template_name = 'operating_theatre/surgical_case_detail.html'
+ template_name = 'operating_theatre/cases/surgical_case_detail.html'
context_object_name = 'surgical_case'
def get_queryset(self):
@@ -776,7 +777,7 @@ class SurgicalCaseCreateView(LoginRequiredMixin, PermissionRequiredMixin, Create
"""
model = SurgicalCase
form_class = SurgicalCaseForm
- template_name = 'operating_theatre/surgical_case_form.html'
+ template_name = 'operating_theatre/cases/surgical_case_form.html'
permission_required = 'operating_theatre.add_surgicalcase'
success_url = reverse_lazy('operating_theatre:surgical_case_list')
@@ -806,7 +807,7 @@ class SurgicalCaseUpdateView(LoginRequiredMixin, PermissionRequiredMixin, Update
Update surgical case (limited to status and notes after surgery starts).
"""
model = SurgicalCase
- template_name = 'operating_theatre/surgical_case_update_form.html'
+ template_name = 'operating_theatre/cases/surgical_case_form.html'
permission_required = 'operating_theatre.change_surgicalcase'
def get_queryset(self):
@@ -830,7 +831,7 @@ class SurgicalCaseUpdateView(LoginRequiredMixin, PermissionRequiredMixin, Update
response = super().form_valid(form)
# Log the action
- AuditLogger.log_action(
+ AuditLogger.log_event(
user=self.request.user,
action='SURGICAL_CASE_UPDATED',
model='SurgicalCase',
diff --git a/templates/.DS_Store b/templates/.DS_Store
index 9402c223..97c6de1b 100644
Binary files a/templates/.DS_Store and b/templates/.DS_Store differ
diff --git a/templates/operating_theatre/.DS_Store b/templates/operating_theatre/.DS_Store
new file mode 100644
index 00000000..304583e9
Binary files /dev/null and b/templates/operating_theatre/.DS_Store differ
diff --git a/templates/operating_theatre/blocks/block_confirm_delete.html b/templates/operating_theatre/blocks/block_confirm_delete.html
new file mode 100644
index 00000000..b9f3e238
--- /dev/null
+++ b/templates/operating_theatre/blocks/block_confirm_delete.html
@@ -0,0 +1,523 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Delete OR Block - {{ block.operating_room.name }}{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
+ Critical Warning
+
+
+ This OR block will be permanently deleted
+ All scheduled cases within this block will be affected
+ Team assignments and resource allocations will be removed
+ Historical data and logs will be preserved for audit purposes
+ Patients and staff will need to be notified of schedule changes
+
+
+
+
+
+
Block Information
+
+
+
Operating Room
+
{{ block.operating_room.name }}
+
+
+
Date & Time
+
+ {{ block.date|date:"l, M d, Y" }}
+ {{ block.start_time|time:"g:i A" }} - {{ block.end_time|time:"g:i A" }}
+
+
+
+
Block Type
+
{{ block.get_block_type_display }}
+
+
+
Primary Surgeon
+
+ {% if block.assigned_surgeon %}
+ {{ block.assigned_surgeon.get_full_name }}
+ {% else %}
+ Not assigned
+ {% endif %}
+
+
+
+
Anesthesiologist
+
+ {% if block.assigned_anesthesiologist %}
+ {{ block.assigned_anesthesiologist.get_full_name }}
+ {% else %}
+ Not assigned
+ {% endif %}
+
+
+
+
Status
+
+ {% if block.status == 'scheduled' %}
+ Scheduled
+ {% elif block.status == 'in_progress' %}
+ In Progress
+ {% elif block.status == 'completed' %}
+ Completed
+ {% elif block.status == 'cancelled' %}
+ Cancelled
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ affected_cases.count }}
+
Scheduled Cases
+
+
+
+
+
{{ affected_staff.count }}
+
Affected Staff
+
+
+
+
+
{{ affected_patients.count }}
+
Affected Patients
+
+
+
+
+
+
+
+ {% if affected_cases %}
+
+
+
+
+ {% for case in affected_cases %}
+
+
+
{{ case.procedure_name }}
+
+ Patient: {{ case.patient.get_full_name }} |
+ Surgeon: {{ case.surgeon.get_full_name }} |
+ Time: {{ case.scheduled_start_time|time:"g:i A" }}
+
+
+
+ {% if case.status == 'scheduled' %}
+ Scheduled
+ {% elif case.status == 'confirmed' %}
+ Confirmed
+ {% elif case.status == 'in_progress' %}
+ In Progress
+ {% endif %}
+
+
+ {% endfor %}
+
+
+
+ {% endif %}
+
+
+
+
+
+ Consider These Alternatives
+
+
Before deleting this block, consider these alternative actions:
+
+
+ Reschedule Block
+
+
+
+ Postpone Block
+
+
+
+ Transfer Cases
+
+
+
+ Notify Staff First
+
+
+
+
+
+
+
+ Deletion Confirmation Required
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/blocks/block_detail.html b/templates/operating_theatre/blocks/block_detail.html
new file mode 100644
index 00000000..5e4f2c3c
--- /dev/null
+++ b/templates/operating_theatre/blocks/block_detail.html
@@ -0,0 +1,534 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}OR Block - {{ block.operating_room.name }}{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+ Back
+
+ {% if block.status == 'available' %}
+
+ Edit
+
+ {% endif %}
+
+ Print
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ block.total_minutes }}
+
Total Minutes
+
+
+
{{ block.scheduled_minutes }}
+
Scheduled
+
+
+
{{ block.available_minutes }}
+
Available
+
+
+
{{ block.turnover_minutes }}
+
Turnover
+
+
+
+
+
+
+
+
+
+ {% for case in block.scheduled_cases.all %}
+
+
+
+
+
+
Procedure
+
{{ case.procedure_name }}
+
+
+
Surgeon
+
{{ case.primary_surgeon.get_full_name }}
+
+
+
Estimated Duration
+
{{ case.estimated_duration }} minutes
+
+
+
Priority
+
+ {% if case.priority == 'emergency' %}
+ Emergency
+ {% elif case.priority == 'urgent' %}
+ Urgent
+ {% else %}
+ Routine
+ {% endif %}
+
+
+
+
+
+
+
+ {% if case.status == 'scheduled' %}
+
+ Start
+
+ {% elif case.status == 'in_progress' %}
+
+ Complete
+
+ {% endif %}
+
+
+
+
+ {% empty %}
+
+
+
No cases scheduled for this block
+ {% if block.status == 'available' %}
+
+ Add First Case
+
+ {% endif %}
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+
Operating Room
+
{{ block.operating_room.name }}
+
+
+
Room Type
+
{{ block.operating_room.get_room_type_display }}
+
+
+
Capacity
+
{{ block.operating_room.capacity }} people
+
+
+
Equipment Level
+
{{ block.operating_room.get_equipment_level_display }}
+
+ {% if block.notes %}
+
+
Notes
+
{{ block.notes }}
+
+ {% endif %}
+
+
+
+
+ {% if block.assigned_surgeon or block.assigned_anesthesiologist or block.assigned_nurses.exists %}
+
+
+
+ {% if block.assigned_surgeon %}
+
+
Primary Surgeon
+
{{ block.assigned_surgeon.get_full_name }}
+
+ {% endif %}
+
+ {% if block.assigned_anesthesiologist %}
+
+
Anesthesiologist
+
{{ block.assigned_anesthesiologist.get_full_name }}
+
+ {% endif %}
+
+ {% if block.assigned_nurses.exists %}
+
+
Nursing Team
+
+ {% for nurse in block.assigned_nurses.all %}
+
{{ nurse.get_full_name }}
+ {% endfor %}
+
+
+ {% endif %}
+
+
+ {% endif %}
+
+
+
+
+
+ {% for activity in block.activities.all %}
+
+
+
+
+
+
{{ activity.action }}
+
{{ activity.created_at|date:"M d, Y H:i" }}
+ {% if activity.notes %}
+
{{ activity.notes }}
+ {% endif %}
+
+
+ {% empty %}
+
+
+
No activity recorded
+
+ {% endfor %}
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/blocks/block_form.html b/templates/operating_theatre/blocks/block_form.html
new file mode 100644
index 00000000..88f75ea3
--- /dev/null
+++ b/templates/operating_theatre/blocks/block_form.html
@@ -0,0 +1,630 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}{% if form.instance.pk %}Edit{% else %}Create{% endif %} OR Block{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+ {% csrf_token %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Scheduling Conflicts Detected
+
+
+
+
+
+
+
+
+
+ Block Preview
+
+
+
+
+ Operating Room: Not selected
+
+
+ Date & Time: Not set
+
+
+ Duration: 0 hours
+
+
+
+
+ Block Type: Not selected
+
+
+ Primary Surgeon: Not assigned
+
+
+ Max Cases: Not set
+
+
+
+
+
+
+
+
+
+
+ Check Availability
+
+
+
+ {% if form.instance.pk %}Update Block{% else %}Create Block{% endif %}
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/blocks/block_schedule_list.html b/templates/operating_theatre/blocks/block_schedule_list.html
new file mode 100644
index 00000000..661510d0
--- /dev/null
+++ b/templates/operating_theatre/blocks/block_schedule_list.html
@@ -0,0 +1,589 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}OR Block Schedule{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Operating Room
+
+ All Rooms
+ {% for room in operating_rooms %}
+
+ {{ room.name }}
+
+ {% endfor %}
+
+
+
+
+
+ Surgeon
+
+ All Surgeons
+ {% for surgeon in surgeons %}
+
+ {{ surgeon.get_full_name }}
+
+ {% endfor %}
+
+
+
+
+
+ Block Type
+
+ All Types
+ Regular
+ Emergency
+ Maintenance
+
+
+
+
+
+ Status
+
+ All Status
+ Available
+ Booked
+ In Progress
+ Completed
+
+
+
+
+
+
+
+
+
+
+ {% for block in blocks %}
+
+
+
+
+
+
+
+
Assigned Surgeon
+
+ {% if block.assigned_surgeon %}
+ {{ block.assigned_surgeon.get_full_name }}
+ {% else %}
+ Unassigned
+ {% endif %}
+
+
+
+
Block Type
+
{{ block.get_block_type_display }}
+
+
+
Duration
+
{{ block.duration_hours }} hours
+
+
+
Utilization
+
+
+
+
{{ block.utilization_percentage }}%
+
+
+
+
+
+ {% if block.scheduled_cases.exists %}
+
+
+ Scheduled Cases ({{ block.scheduled_cases.count }})
+
+ {% for case in block.scheduled_cases.all %}
+
+
{{ case.scheduled_start_time|date:"H:i" }}
+
+
{{ case.patient.get_full_name }}
+
{{ case.procedure_name }}
+
+
+ {% if case.status == 'scheduled' %}
+ Scheduled
+ {% elif case.status == 'in_progress' %}
+ In Progress
+ {% elif case.status == 'completed' %}
+ Completed
+ {% elif case.status == 'cancelled' %}
+ Cancelled
+ {% endif %}
+
+
+ {% endfor %}
+
+ {% else %}
+
+ {% endif %}
+
+
+
+
+ {% if block.status == 'available' %}
+
+ Add Case
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+ {% empty %}
+
+
+
+
No blocks scheduled
+
No OR blocks are scheduled for the selected date and filters.
+
+ Create First Block
+
+
+
+ {% endfor %}
+
+
+
+ {% if is_paginated %}
+
+
+
+
+
+ {% endif %}
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/case_list.html b/templates/operating_theatre/cases/case_list.html
similarity index 100%
rename from templates/operating_theatre/case_list.html
rename to templates/operating_theatre/cases/case_list.html
diff --git a/templates/operating_theatre/cases/surgical_case_form.html b/templates/operating_theatre/cases/surgical_case_form.html
index 798dc7cc..11a722ea 100644
--- a/templates/operating_theatre/cases/surgical_case_form.html
+++ b/templates/operating_theatre/cases/surgical_case_form.html
@@ -4,9 +4,9 @@
{% block title %}{% if object %}Edit{% else %}Create{% endif %} Surgical Case - Operating Theatre{% endblock %}
{% block css %}
-
-
-
+
+
+
{% endblock %}
{% block content %}
@@ -404,9 +404,9 @@
{% endblock %}
{% block js %}
-
-
-
+
+
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/equipment/equipment_detail.html b/templates/operating_theatre/equipment/equipment_detail.html
new file mode 100644
index 00000000..49b4fdad
--- /dev/null
+++ b/templates/operating_theatre/equipment/equipment_detail.html
@@ -0,0 +1,691 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}{{ equipment.name }} - Equipment Details{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+ {% if equipment.maintenance_due %}
+
+
+ Maintenance Due
+
+
+ This equipment is due for maintenance. Last maintenance was on
+ {% if equipment.last_maintenance_date %}
+ {{ equipment.last_maintenance_date|date:"M d, Y" }}
+ {% else %}
+ never
+ {% endif %}.
+
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
Equipment ID
+
{{ equipment.equipment_id|default:"Not assigned" }}
+
+
+
Asset Tag
+
{{ equipment.asset_tag|default:"Not assigned" }}
+
+
+
Category
+
{{ equipment.get_category_display }}
+
+
+
Current Status
+
+
+ {{ equipment.get_status_display }}
+
+
+
+
Purchase Cost
+
+ {% if equipment.purchase_cost %}
+ ${{ equipment.purchase_cost|floatformat:2 }}
+ {% else %}
+ Not recorded
+ {% endif %}
+
+
+
+
Depreciation
+
+ {% if equipment.depreciation_rate %}
+ {{ equipment.depreciation_rate }}% per year
+ {% else %}
+ Not set
+ {% endif %}
+
+
+
+
+
+
+
+ {% if equipment.specifications %}
+
+
+
+
+
+
+ Specification
+ Value
+
+
+
+ {% for spec, value in equipment.specifications.items %}
+
+ {{ spec|title }}
+ {{ value }}
+
+ {% endfor %}
+
+
+
+
+ {% endif %}
+
+
+
+
+
+ {% if equipment.maintenance_records.all %}
+
+ {% for record in equipment.maintenance_records.all %}
+
+
+
+
{{ record.date|date:"M d, Y" }}
+
{{ record.maintenance_type|title }}
+
+ {{ record.description|default:"No description provided" }}
+ {% if record.performed_by %}
+ Performed by: {{ record.performed_by.get_full_name }}
+ {% endif %}
+
+
+
+ {% endfor %}
+
+ {% else %}
+
+
+
No maintenance records found
+
+ Schedule First Maintenance
+
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ equipment.total_usage_hours|default:0 }}
+
+
Total Hours
+
+
+
+ {{ equipment.monthly_usage_hours|default:0 }}
+
+
This Month
+
+
+
+ {{ equipment.utilization_rate|default:0 }}%
+
+
Utilization
+
+
+
+ {{ equipment.efficiency_score|default:0 }}%
+
+
Efficiency
+
+
+
+
+
+
+
+
+
+
+
Equipment QR Code
+
+ {% if equipment.qr_code %}
+
+ {% else %}
+
+ {% endif %}
+
+
+ Download QR Code
+
+
+
+
+
+
+
+
+ {% if equipment.status == 'available' %}
+
+ Reserve Equipment
+
+ {% elif equipment.status == 'reserved' %}
+
+ Release Reservation
+
+ {% endif %}
+
+
+ Schedule Maintenance
+
+
+
+ View Full History
+
+
+
+ Report Issue
+
+
+
+
+
+
+ {% if equipment.current_assignment %}
+
+
+
+
+ Assigned to: {{ equipment.current_assignment.assigned_to.get_full_name }}
+
+
+ Since: {{ equipment.current_assignment.assigned_date|date:"M d, Y" }}
+
+
+ Purpose: {{ equipment.current_assignment.purpose|default:"General use" }}
+
+ {% if equipment.current_assignment.expected_return %}
+
+ Expected Return: {{ equipment.current_assignment.expected_return|date:"M d, Y" }}
+
+ {% endif %}
+
+
+ {% endif %}
+
+
+ {% if equipment.documents.all %}
+
+
+
+ {% for document in equipment.documents.all %}
+
+
+
{{ document.name }}
+
{{ document.document_type|title }}
+
+
+
+
+
+ {% endfor %}
+
+
+ {% endif %}
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/equipment/equipment_form.html b/templates/operating_theatre/equipment/equipment_form.html
new file mode 100644
index 00000000..8882502f
--- /dev/null
+++ b/templates/operating_theatre/equipment/equipment_form.html
@@ -0,0 +1,743 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}{% if form.instance.pk %}Edit{% else %}Add{% endif %} Equipment{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+ {% csrf_token %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Preview
+
+
+
+ {% if form.instance.pk %}Update Equipment{% else %}Add Equipment{% endif %}
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/equipment/equipment_list.html b/templates/operating_theatre/equipment/equipment_list.html
new file mode 100644
index 00000000..073a177d
--- /dev/null
+++ b/templates/operating_theatre/equipment/equipment_list.html
@@ -0,0 +1,583 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}OR Equipment Management{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+ {% if maintenance_alerts %}
+
+
+ Maintenance Alerts
+
+
+ {% for alert in maintenance_alerts %}
+ {{ alert.equipment_name }} - {{ alert.message }}
+ {% endfor %}
+
+
+ {% endif %}
+
+
+
+
+
{{ stats.available_equipment }}
+
Available
+
+
+
{{ stats.in_use_equipment }}
+
In Use
+
+
+
{{ stats.maintenance_equipment }}
+
Maintenance
+
+
+
{{ stats.out_of_order_equipment }}
+
Out of Order
+
+
+
+
+
+
+
+
+
+ Category
+
+ All Categories
+ {% for category in equipment_categories %}
+
+ {{ category.1 }}
+
+ {% endfor %}
+
+
+
+
+
+ Status
+
+ All Status
+ Available
+ In Use
+ Maintenance
+ Out of Order
+
+
+
+
+
+ Location
+
+ All Locations
+ {% for room in operating_rooms %}
+
+ {{ room.name }}
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+ {% for equipment in equipment_list %}
+
+
+ {% if equipment.image %}
+
+ {% else %}
+
+
+
+ {% endif %}
+
+
+
+
{{ equipment.name }}
+
+
+ {% if equipment.status == 'available' %}
+ Available
+ {% elif equipment.status == 'in_use' %}
+ In Use
+ {% elif equipment.status == 'maintenance' %}
+ Maintenance
+ {% elif equipment.status == 'out_of_order' %}
+ Out of Order
+ {% elif equipment.status == 'reserved' %}
+ Reserved
+ {% endif %}
+
+
+
+
+
+
Serial Number
+
{{ equipment.serial_number }}
+
+
+
Category
+
{{ equipment.get_category_display }}
+
+
+
Manufacturer
+
{{ equipment.manufacturer }}
+
+
+
Model
+
{{ equipment.model }}
+
+
+
Location
+
+ {% if equipment.current_location %}
+ {{ equipment.current_location.name }}
+ {% else %}
+ Not assigned
+ {% endif %}
+
+
+
+
Last Maintenance
+
+ {% if equipment.last_maintenance_date %}
+ {{ equipment.last_maintenance_date|date:"M d, Y" }}
+ {% else %}
+ Never
+ {% endif %}
+
+
+
+
+ {% if equipment.next_maintenance_due %}
+
+
+
+ Next maintenance: {{ equipment.next_maintenance_due|date:"M d, Y" }}
+
+
+ {% endif %}
+
+
+
+
+ {% if equipment.status == 'available' %}
+
+ Reserve
+
+ {% elif equipment.status == 'reserved' %}
+
+ Release
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+ {% empty %}
+
+ {% endfor %}
+
+
+
+ {% if is_paginated %}
+
+
+
+
+
+ {% endif %}
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/notes/operative_note_detail.html b/templates/operating_theatre/notes/operative_note_detail.html
new file mode 100644
index 00000000..6aa47365
--- /dev/null
+++ b/templates/operating_theatre/notes/operative_note_detail.html
@@ -0,0 +1,608 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Operative Note - {{ note.patient.get_full_name }}{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+ Print
+
+
+ PDF
+
+ {% if note.status == 'draft' or note.status == 'pending' %}
+
+ Edit
+
+ {% endif %}
+
+
+
+
+
+
+
+
{{ hospital.name }}
+
{{ hospital.address }}
+
OPERATIVE NOTE
+
+
+
+
+
+
+
+
+
+
+
+
+
Primary Procedure
+
{{ note.procedure_name }}
+
+
+
Procedure Code
+
{{ note.procedure_code }}
+
+
+
Laterality
+
{{ note.get_laterality_display|default:"Not specified" }}
+
+
+
Approach
+
{{ note.get_approach_display|default:"Not specified" }}
+
+
+
+ {% if note.secondary_procedures %}
+
+
Secondary Procedures:
+
{{ note.secondary_procedures }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
Primary Surgeon
+
{{ note.primary_surgeon.get_full_name }}
+
+ {% if note.assistant_surgeon %}
+
+
Assistant Surgeon
+
{{ note.assistant_surgeon.get_full_name }}
+
+ {% endif %}
+ {% if note.anesthesiologist %}
+
+
Anesthesiologist
+
{{ note.anesthesiologist.get_full_name }}
+
+ {% endif %}
+ {% if note.scrub_nurse %}
+
+
Scrub Nurse
+
{{ note.scrub_nurse.get_full_name }}
+
+ {% endif %}
+
+
+ {% if note.other_team_members %}
+
+
Other Team Members:
+
{{ note.other_team_members }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
Surgery Start Time
+
{{ note.surgery_start_time|date:"H:i" }}
+
+ {% if note.surgery_end_time %}
+
+
Surgery End Time
+
{{ note.surgery_end_time|date:"H:i" }}
+
+
+
Total Duration
+
{{ note.surgery_duration }} minutes
+
+ {% endif %}
+ {% if note.anesthesia_start_time %}
+
+
Anesthesia Start
+
{{ note.anesthesia_start_time|date:"H:i" }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+ {% if note.preoperative_diagnosis %}
+
+
Preoperative Diagnosis:
+
{{ note.preoperative_diagnosis }}
+
+ {% endif %}
+
+ {% if note.postoperative_diagnosis %}
+
+
Postoperative Diagnosis:
+
{{ note.postoperative_diagnosis }}
+
+ {% endif %}
+
+ {% if note.indications %}
+
+
Indications for Surgery:
+
{{ note.indications }}
+
+ {% endif %}
+
+
+
+
+ {% if note.anesthesia_type %}
+
+
+
+
+
+
Anesthesia Type
+
{{ note.get_anesthesia_type_display }}
+
+ {% if note.asa_classification %}
+
+
ASA Classification
+
{{ note.asa_classification }}
+
+ {% endif %}
+
+
+ {% if note.anesthesia_notes %}
+
+
Anesthesia Notes:
+
{{ note.anesthesia_notes }}
+
+ {% endif %}
+
+
+ {% endif %}
+
+
+
+
+
+ {% if note.operative_technique %}
+
+
Technique Description:
+
{{ note.operative_technique }}
+
+ {% endif %}
+
+ {% if note.findings %}
+
+
Operative Findings:
+
{{ note.findings }}
+
+ {% endif %}
+
+ {% if note.specimens %}
+
+
Specimens Sent:
+
{{ note.specimens }}
+
+ {% endif %}
+
+
+
+
+ {% if note.complications %}
+
+
+
+
+
Complications Noted:
+
{{ note.complications }}
+
+
+
+ {% endif %}
+
+
+
+
+
+ {% if note.postoperative_instructions %}
+
+
Postoperative Instructions:
+
{{ note.postoperative_instructions }}
+
+ {% endif %}
+
+ {% if note.estimated_blood_loss %}
+
+
+
Estimated Blood Loss
+
{{ note.estimated_blood_loss }} mL
+
+ {% if note.fluid_replacement %}
+
+
Fluid Replacement
+
{{ note.fluid_replacement }}
+
+ {% endif %}
+
+ {% endif %}
+
+ {% if note.disposition %}
+
+
Patient Disposition:
+
{{ note.disposition }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+ Electronic Signature
+
+ {% if note.status == 'signed' %}
+
+ Signed by: {{ note.primary_surgeon.get_full_name }}
+
+
+ Date & Time: {{ note.signed_at|date:"M d, Y H:i" }}
+
+
+ Digital Signature: {{ note.signature_hash }}
+
+ {% elif note.status == 'pending' %}
+
This operative note is pending electronic signature by the primary surgeon.
+ {% if note.primary_surgeon == request.user %}
+
+ Sign Note
+
+ {% endif %}
+ {% else %}
+
This operative note is in draft status and has not been submitted for signature.
+ {% endif %}
+
+
+ {% if note.status == 'signed' %}
+
+
+
Electronically Signed
+
+ {% elif note.status == 'pending' %}
+
+ {% else %}
+
+ {% endif %}
+
+
+
+
+
+ {% if note.amendments.exists %}
+
+
+
+ {% for amendment in note.amendments.all %}
+
+
+
+
+
+
Amendment {{ forloop.counter }}
+
{{ amendment.created_at|date:"M d, Y H:i" }} by {{ amendment.created_by.get_full_name }}
+
+ Reason: {{ amendment.reason }}
+
+ {% if amendment.changes %}
+
+ Changes: {{ amendment.changes }}
+
+ {% endif %}
+
+
+ {% endfor %}
+
+
+ {% endif %}
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/notes/operative_note_list.html b/templates/operating_theatre/notes/operative_note_list.html
new file mode 100644
index 00000000..15e3ebd7
--- /dev/null
+++ b/templates/operating_theatre/notes/operative_note_list.html
@@ -0,0 +1,465 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Operative Notes{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
{{ stats.total_notes }}
+
Total Notes
+
+
+
+
+
+
+
+
+
+
+
+
{{ stats.pending_signature }}
+
Pending Signature
+
+
+
+
+
+
+
+
+
+
+
+
{{ stats.today_notes }}
+
Today's Notes
+
+
+
+
+
+
+
+
+
+
+
+
{{ stats.overdue_notes }}
+
Overdue
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Date Range
+
+ All Dates
+ Today
+ This Week
+ This Month
+ Custom Range
+
+
+
+
+
+ Status
+
+ All Status
+ Draft
+ Pending Signature
+ Signed
+ Amended
+
+
+
+
+
+ Surgeon
+
+ All Surgeons
+ {% for surgeon in surgeons %}
+
+ {{ surgeon.get_full_name }}
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+ {% for note in notes %}
+
+
+
+
+
+
+
+ Patient ID: {{ note.patient.patient_id }}
+
+
+ Surgeon: {{ note.primary_surgeon.get_full_name }}
+
+
+ Operating Room: {{ note.operating_room.name }}
+
+
+ Duration:
+ {% if note.surgery_end_time %}
+ {{ note.surgery_duration }} minutes
+ {% else %}
+ In Progress
+ {% endif %}
+
+
+
+
+ Status:
+ {% if note.status == 'draft' %}
+ Draft
+ {% elif note.status == 'pending' %}
+ Pending Signature
+ {% elif note.status == 'signed' %}
+ Signed
+ {% elif note.status == 'amended' %}
+ Amended
+ {% endif %}
+
+
+ Created: {{ note.created_at|date:"M d, Y H:i" }}
+
+
+ Last Updated: {{ note.updated_at|date:"M d, Y H:i" }}
+
+ {% if note.signed_at %}
+
+ Signed: {{ note.signed_at|date:"M d, Y H:i" }}
+
+ {% endif %}
+
+
+
+
+
+ View
+
+ {% if note.status == 'draft' or note.status == 'pending' %}
+
+ Edit
+
+ {% endif %}
+ {% if note.status == 'pending' and note.primary_surgeon == request.user %}
+
+ Sign
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+ {% empty %}
+
+ {% endfor %}
+
+
+
+ {% if is_paginated %}
+
+
+
+
+
+ {% endif %}
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/notes/surgical_note_confirm_delete.html b/templates/operating_theatre/notes/surgical_note_confirm_delete.html
new file mode 100644
index 00000000..351a721e
--- /dev/null
+++ b/templates/operating_theatre/notes/surgical_note_confirm_delete.html
@@ -0,0 +1,596 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Delete Surgical Note - {{ note.patient.get_full_name }}{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
+
+
Warning: This action cannot be undone
+
Deleting this surgical note will permanently remove all associated data from the system.
+
+
+
+
+
+
+
+
+
+
+
Patient
+
+ {{ note.patient.get_full_name }}
+ ID: {{ note.patient.patient_id }}
+
+
+
+
+
Procedure
+
+ {{ note.procedure_name }}
+ {% if note.procedure_code %}
+ Code: {{ note.procedure_code }}
+ {% endif %}
+
+
+
+
+
Surgeon
+
+ {{ note.surgeon.get_full_name }}
+ {% if note.surgeon.specialization %}
+ {{ note.surgeon.specialization }}
+ {% endif %}
+
+
+
+
+
Surgery Date
+
+ {{ note.surgery_date|date:"F d, Y" }}
+ {{ note.surgery_date|time:"g:i A" }}
+
+
+
+
+
Status
+
+
+ {{ note.get_status_display }}
+
+
+
+
+
+
Priority
+
+
+ {{ note.get_priority_display }}
+
+
+
+
+
+
Created
+
+ {{ note.created_at|date:"M d, Y" }}
+ {{ note.created_at|time:"g:i A" }}
+
+
+
+
+
Last Modified
+
+ {{ note.updated_at|date:"M d, Y" }}
+ {{ note.updated_at|time:"g:i A" }}
+
+
+
+
+ {% if note.preoperative_diagnosis %}
+
+
+
+
Pre-operative Diagnosis
+
{{ note.preoperative_diagnosis|truncatewords:10 }}
+
+
+ {% if note.postoperative_diagnosis %}
+
+
+
Post-operative Diagnosis
+
{{ note.postoperative_diagnosis|truncatewords:10 }}
+
+
+ {% endif %}
+
+ {% endif %}
+
+
+
+
+
+
Consequences of Deletion
+
+ Permanent Data Loss: All surgical note content will be permanently deleted
+ Audit Trail: The deletion will be logged for compliance purposes
+ Patient Records: This note will no longer appear in the patient's medical history
+ Reporting: This note will be excluded from all future reports and statistics
+ {% if note.status == 'signed' %}
+ Legal Implications: Deleting a signed surgical note may have legal consequences
+ {% endif %}
+ {% if note.is_emergency %}
+ Emergency Record: This emergency surgical record will be permanently lost
+ {% endif %}
+
+
+
+
+ {% if note.status == 'signed' %}
+
+
Signed Document Warning
+
This surgical note has been electronically signed. Deleting signed medical documents may violate regulatory requirements and institutional policies. Please consult with your compliance officer before proceeding.
+
+ {% endif %}
+
+ {% if note.is_emergency %}
+
+
Emergency Surgery Record
+
This is an emergency surgical note. Emergency records are often subject to additional regulatory scrutiny and may be required for quality assurance reviews.
+
+ {% endif %}
+
+
+
+ {% csrf_token %}
+
+
+
Confirmation Required
+
+
+
+
+
+ I understand that this action will permanently delete the surgical note and cannot be undone
+
+
+
+
+
+
+
+
+ I have the authority to delete this surgical note
+
+
+
+
+ {% if note.status == 'signed' %}
+
+
+
+
+ I acknowledge the legal implications of deleting a signed medical document
+
+
+
+ {% endif %}
+
+
+
+ Reason for Deletion *
+
+
+
This reason will be logged for audit purposes
+
+
+
+
+ Type "DELETE" to confirm *
+
+
+
This additional confirmation helps prevent accidental deletions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Are you absolutely sure?
+
This surgical note will be permanently deleted. This action cannot be undone.
+
+
+ Patient: {{ note.patient.get_full_name }}
+ Procedure: {{ note.procedure_name }}
+ Date: {{ note.surgery_date|date:"F d, Y" }}
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/notes/surgical_note_detail.html b/templates/operating_theatre/notes/surgical_note_detail.html
new file mode 100644
index 00000000..26fc8239
--- /dev/null
+++ b/templates/operating_theatre/notes/surgical_note_detail.html
@@ -0,0 +1,649 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Surgical Note - {{ note.patient.get_full_name }}{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Pre-operative Diagnosis
+
{{ note.preoperative_diagnosis|default:"Not specified" }}
+
+
+
Planned Procedure
+
{{ note.planned_procedure|default:"Not specified" }}
+
+
+
Anesthesia Type
+
{{ note.get_anesthesia_type_display|default:"Not specified" }}
+
+
+
ASA Classification
+
{{ note.asa_classification|default:"Not specified" }}
+
+
+
+ {% if note.preoperative_notes %}
+
+
Pre-operative Notes
+
{{ note.preoperative_notes|linebreaks }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
Actual Procedure
+
{{ note.actual_procedure|default:"Not specified" }}
+
+
+
Procedure Duration
+
{{ note.procedure_duration|default:"Not specified" }}
+
+
+
Incision Type
+
{{ note.incision_type|default:"Not specified" }}
+
+
+
Closure Method
+
{{ note.closure_method|default:"Not specified" }}
+
+
+
+ {% if note.operative_findings %}
+
+
Operative Findings
+
{{ note.operative_findings|linebreaks }}
+
+ {% endif %}
+
+ {% if note.procedure_description %}
+
+
Detailed Procedure Description
+
{{ note.procedure_description|linebreaks }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
Post-operative Diagnosis
+
{{ note.postoperative_diagnosis|default:"Not specified" }}
+
+
+
Estimated Blood Loss
+
{{ note.estimated_blood_loss|default:"Not specified" }}
+
+
+
Complications
+
{{ note.complications|default:"None reported" }}
+
+
+
Condition at End
+
{{ note.condition_at_end|default:"Not specified" }}
+
+
+
+ {% if note.postoperative_instructions %}
+
+
Post-operative Instructions
+
{{ note.postoperative_instructions|linebreaks }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
Primary Surgeon
+
{{ note.surgeon.get_full_name }}
+
+ {% if note.assistant_surgeon %}
+
+
Assistant Surgeon
+
{{ note.assistant_surgeon.get_full_name }}
+
+ {% endif %}
+ {% if note.anesthesiologist %}
+
+
Anesthesiologist
+
{{ note.anesthesiologist.get_full_name }}
+
+ {% endif %}
+ {% if note.scrub_nurse %}
+
+
Scrub Nurse
+
{{ note.scrub_nurse.get_full_name }}
+
+ {% endif %}
+
+
+
+
+
+ {% if note.revisions.exists %}
+
+
+
+
+ {% for revision in note.revisions.all %}
+
+
+
+
+
{{ revision.get_action_display }}
+ {{ revision.created_at|date:"M d, Y g:i A" }}
+
+
By: {{ revision.created_by.get_full_name }}
+ {% if revision.reason %}
+
Reason: {{ revision.reason }}
+ {% endif %}
+
+
+ {% endfor %}
+
+
+
+ {% endif %}
+
+
+ {% if note.status == 'signed' %}
+
+
+
+
+
+
+
Electronically Signed
+
Signed by: {{ note.signed_by.get_full_name }}
+
Date: {{ note.signed_at|date:"M d, Y g:i A" }}
+
IP Address: {{ note.signature_ip|default:"Not recorded" }}
+
+
+
+
+ {% elif note.status == 'completed' %}
+
+
+ Electronic Signature Required
+
+
This note is complete and ready for electronic signature.
+
+ Sign Note
+
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+ By signing this note, you confirm that all information is accurate and complete.
+
+
+
+ {% csrf_token %}
+
+ Password Confirmation
+
+
+
+
+ Signature Comments (Optional)
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/notes/surgical_note_form.html b/templates/operating_theatre/notes/surgical_note_form.html
new file mode 100644
index 00000000..cca2728e
--- /dev/null
+++ b/templates/operating_theatre/notes/surgical_note_form.html
@@ -0,0 +1,1009 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}{% if note.pk %}Edit{% else %}Create{% endif %} Surgical Note{% endblock %}
+
+{% block extra_css %}
+
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+ Auto-saved
+
+
+
+
+
+
+ {% csrf_token %}
+
+
+ {% if not note.pk %}
+
+
+
+
+ Use Template
+
+
Start with a pre-defined template to speed up note creation
+
+
+
+ Select Template...
+ {% for template in templates %}
+
+ {{ template.name }}
+
+ {% endfor %}
+
+
+
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% if note.pk and note.status == 'completed' %}
+
+ {% endif %}
+
+
+
+
+
+ Preview
+
+
+ Validate
+
+
+
+
+
+ Cancel
+
+
+ Save Draft
+
+
+
+ {% if note.pk %}Update Note{% else %}Create Note{% endif %}
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+
+
+
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/notes/surgical_note_list.html b/templates/operating_theatre/notes/surgical_note_list.html
new file mode 100644
index 00000000..69c4314e
--- /dev/null
+++ b/templates/operating_theatre/notes/surgical_note_list.html
@@ -0,0 +1,516 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Surgical Notes{% endblock %}
+
+{% block extra_css %}
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
{{ stats.total_notes|default:0 }}
+
Total Notes
+
+
+
+
+
+
+
{{ stats.draft_notes|default:0 }}
+
Draft Notes
+
+
+
+
+
+
+
{{ stats.completed_notes|default:0 }}
+
Completed
+
+
+
+
+
+
+
{{ stats.signed_notes|default:0 }}
+
Signed
+
+
+
+
+
+
+
+ Status
+
+ All Statuses
+ Draft
+ In Progress
+ Completed
+ Signed
+ Amended
+
+
+
+ Surgeon
+
+ All Surgeons
+ {% for surgeon in surgeons %}
+ {{ surgeon.get_full_name }}
+ {% endfor %}
+
+
+
+ Date Range
+
+ All Dates
+ Today
+ This Week
+ This Month
+ Custom Range
+
+
+
+ Priority
+
+ All Priorities
+ Low
+ Medium
+ High
+ Critical
+
+
+
+
+
+
+
+
+
+
+ Apply
+
+
+ Clear
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Patient
+ Procedure
+ Surgeon
+ Date
+ Status
+ Priority
+ Last Modified
+ Actions
+
+
+
+ {% for note in notes %}
+
+
+
+
+
+
+
+
+
+
+
{{ note.patient.get_full_name }}
+
ID: {{ note.patient.patient_id }}
+
+
+
+
+ {{ note.procedure_name }}
+ {{ note.procedure_code|default:"" }}
+
+
+ {{ note.surgeon.get_full_name }}
+ {{ note.surgeon.specialization|default:"" }}
+
+
+ {{ note.surgery_date|date:"M d, Y" }}
+ {{ note.surgery_date|time:"g:i A" }}
+
+
+
+ {{ note.get_status_display }}
+
+
+
+
+ {{ note.get_priority_display }}
+
+
+
+ {{ note.updated_at|date:"M d, Y" }}
+ {{ note.updated_at|time:"g:i A" }}
+
+
+
+
+
+
+ {% if note.status != 'signed' %}
+
+
+
+ {% endif %}
+
+
+
+ {% if note.status != 'signed' %}
+
+
+
+ {% endif %}
+
+
+
+ {% empty %}
+
+
+
+ No surgical notes found
+
+ Create First Note
+
+
+
+ {% endfor %}
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+
+
+
+
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/templates/surgical_note_template_confirm_delete.html b/templates/operating_theatre/templates/surgical_note_template_confirm_delete.html
new file mode 100644
index 00000000..49549ede
--- /dev/null
+++ b/templates/operating_theatre/templates/surgical_note_template_confirm_delete.html
@@ -0,0 +1,838 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Delete Template - {{ template.name }}{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
+
+
Warning: This action cannot be undone
+
Deleting this template will permanently remove it from the system and affect all dependent surgical notes.
+
+
+
+
+
+
+
+
+
+
+
Template Name
+
+ {{ template.name }}
+
+
+
+
+
Category
+
+
+ {{ template.get_category_display }}
+
+
+
+
+
+
Status
+
+
+ {{ template.get_status_display }}
+
+
+
+
+
+
Created By
+
+ {{ template.created_by.get_full_name }}
+ {{ template.created_by.specialization|default:"" }}
+
+
+
+
+
Created Date
+
+ {{ template.created_at|date:"F d, Y" }}
+ {{ template.created_at|time:"g:i A" }}
+
+
+
+
+
Last Modified
+
+ {{ template.updated_at|date:"M d, Y" }}
+ {{ template.updated_at|time:"g:i A" }}
+
+
+
+
+
Version
+
+ v{{ template.version|default:1 }}
+ {% if template.is_latest_version %}
+ Latest Version
+ {% else %}
+ Outdated Version
+ {% endif %}
+
+
+
+
+
Content Size
+
+ {{ template.content|length|filesizeformat }}
+ {{ template.content|length }} characters
+
+
+
+
+ {% if template.description %}
+
+
Description
+
{{ template.description }}
+
+ {% endif %}
+
+ {% if template.tags.all %}
+
+
Tags
+
+ {% for tag in template.tags.all %}
+ {{ tag.name }}
+ {% endfor %}
+
+
+ {% endif %}
+
+
+
+
+
+
Usage Impact Analysis
+
+
+
+
{{ template.usage_count|default:0 }}
+
Total Uses
+
+
+
+
{{ template.active_notes_count|default:0 }}
+
Active Notes
+
+
+
+
{{ template.unique_users|default:0 }}
+
Users Affected
+
+
+
+
{{ template.usage_this_month|default:0 }}
+
Uses This Month
+
+
+
+
+ Template Removal: This template will no longer be available for creating new surgical notes
+ Existing Notes: {{ template.active_notes_count|default:0 }} surgical notes currently use this template
+ User Impact: {{ template.unique_users|default:0 }} users have used this template
+ Version History: All version history for this template will be permanently lost
+ {% if template.is_default %}
+ Default Template: This is the default template for {{ template.get_category_display }} - a new default will need to be set
+ {% endif %}
+ {% if template.is_public %}
+ Public Access: Other users will lose access to this shared template
+ {% endif %}
+
+
+
+
+ {% if dependent_notes %}
+
+
+ Surgical Notes Using This Template ({{ dependent_notes|length }})
+
+
+ {% for note in dependent_notes %}
+
+
+
{{ note.patient.get_full_name }}
+
+ {{ note.procedure_name }} - {{ note.surgery_date|date:"M d, Y" }}
+ {{ note.get_status_display }}
+
+
+
+
+
+
+ {% endfor %}
+
+
+
+ Note: Existing surgical notes will retain their content, but will no longer be linked to this template.
+
+
+ {% endif %}
+
+
+ {% if template.status == 'active' %}
+
+
Active Template Warning
+
This template is currently active and being used by medical staff. Deleting it may disrupt workflow and force users to find alternative templates.
+
+ {% endif %}
+
+ {% if template.is_default %}
+
+
Default Template Warning
+
This is the default template for {{ template.get_category_display }}. After deletion, you will need to set a new default template for this category.
+
+ {% endif %}
+
+ {% if template.usage_count > 50 %}
+
+
High Usage Template
+
This template has been used {{ template.usage_count }} times. Consider archiving instead of deleting to preserve historical data.
+
+ {% endif %}
+
+
+
+ {% csrf_token %}
+
+
+
Confirmation Required
+
+
+
+
+
+ I understand that this action will permanently delete the template and cannot be undone
+
+
+
+
+
+
+
+
+ I have the authority to delete this template
+
+
+
+
+ {% if template.status == 'active' %}
+
+
+
+
+ I acknowledge that deleting an active template may disrupt medical workflows
+
+
+
+ {% endif %}
+
+ {% if template.is_default %}
+
+
+
+
+ I will set a new default template for {{ template.get_category_display }} after deletion
+
+
+
+ {% endif %}
+
+ {% if dependent_notes %}
+
+
+
+
+ I understand that {{ dependent_notes|length }} surgical notes will be affected by this deletion
+
+
+
+ {% endif %}
+
+
+
+ Reason for Deletion *
+
+
+
This reason will be logged for audit purposes and compliance
+
+
+
+
+ Replacement Template (Optional)
+
+
+ No replacement
+ {% for alt_template in alternative_templates %}
+ {{ alt_template.name }}
+ {% endfor %}
+
+
Suggest an alternative template for users
+
+
+
+
+ Type "DELETE TEMPLATE" to confirm *
+
+
+
This additional confirmation helps prevent accidental deletions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Are you absolutely sure?
+
This template will be permanently deleted. This action cannot be undone.
+
+
+ Template: {{ template.name }}
+ Category: {{ template.get_category_display }}
+ Usage Count: {{ template.usage_count|default:0 }} times
+ {% if dependent_notes %}
+ Affected Notes: {{ dependent_notes|length }} surgical notes
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Archiving will make the template inactive but preserve all data and history.
+
+
+
+ Archive Reason
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/templates/surgical_note_template_detail.html b/templates/operating_theatre/templates/surgical_note_template_detail.html
new file mode 100644
index 00000000..880d3493
--- /dev/null
+++ b/templates/operating_theatre/templates/surgical_note_template_detail.html
@@ -0,0 +1,1147 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}{{ template.name }} - Template Details{% endblock %}
+
+{% block extra_css %}
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Template Name
+
{{ template.name }}
+
+
+
+
Category
+
{{ template.get_category_display }}
+
+
+
+
Status
+
+
+ {{ template.get_status_display }}
+
+
+
+
+
+
Created By
+
+ {{ template.created_by.get_full_name }}
+ {{ template.created_by.specialization|default:"" }}
+
+
+
+
+
Created Date
+
+ {{ template.created_at|date:"F d, Y" }}
+ {{ template.created_at|time:"g:i A" }}
+
+
+
+
+
Last Updated
+
+ {{ template.updated_at|date:"F d, Y" }}
+ {{ template.updated_at|time:"g:i A" }}
+
+
+
+
+
Version
+
+ v{{ template.version|default:1 }}
+ {% if template.is_latest_version %}
+ Latest Version
+ {% else %}
+ Outdated Version
+ {% endif %}
+
+
+
+
+
File Size
+
+ {{ template.content|length|filesizeformat }}
+ {{ template.content|length }} characters
+
+
+
+
+ {% if template.tags.all %}
+
+
Tags
+ {% for tag in template.tags.all %}
+
{{ tag.name }}
+ {% endfor %}
+
+ {% endif %}
+
+ {% if template.keywords %}
+
+
Keywords
+
{{ template.keywords }}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+ {{ template.content|linebreaks }}
+
+
+
+
+
{{ template.content }}
+
+
+
+
+
+ {{ template.content|length }} characters, {{ template.content|wordcount }} words
+
+
+
+ Copy Content
+
+
+ Download
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ template.usage_count|default:0 }}
+
Total Uses
+
+
+
+
{{ template.usage_this_month|default:0 }}
+
This Month
+
+
+
+
{{ template.usage_this_week|default:0 }}
+
This Week
+
+
+
+
{{ template.unique_users|default:0 }}
+
Unique Users
+
+
+
+
+
Usage Trend (Last 30 Days)
+
+
+
+
+
+
+
+
+
+
+ {% for usage in recent_usage %}
+
+
+ {{ usage.user.first_name.0|default:"U" }}{{ usage.user.last_name.0|default:"" }}
+
+
+
{{ usage.user.get_full_name }}
+
+ Used {{ usage.created_at|timesince }} ago
+ {% if usage.surgical_note %}
+ for {{ usage.surgical_note.patient.get_full_name }}
+ {% endif %}
+
+
+ {% if usage.surgical_note %}
+
+ {% endif %}
+
+ {% empty %}
+
+
+
No recent usage found
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+ {% for version in version_history %}
+
+
+ v{{ version.version }}
+
+
+
{{ version.change_summary|default:"Version update" }}
+
+ {{ version.created_at|date:"M d, Y g:i A" }} by {{ version.created_by.get_full_name }}
+ {% if version.is_current %}
+ Current
+ {% endif %}
+
+
+
+
+
+
+ {% if not version.is_current %}
+
+
+
+ {% endif %}
+
+
+ {% empty %}
+
+
+
No version history available
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Usage Rate
+ {{ template.usage_percentage|default:0 }}%
+
+
+
+
+
+
+ User Satisfaction
+ {{ template.satisfaction_rate|default:0 }}%
+
+
+
+
+
+
+
{{ template.favorites_count|default:0 }}
+
Favorites
+
+
+
{{ template.reviews_count|default:0 }}
+
Reviews
+
+
+
+
+
+
+ {% if related_templates %}
+
+
+
+ {% for related in related_templates %}
+
+
+
{{ related.name }}
+
{{ related.get_category_display }}
+
+
+
+
+
+ {% endfor %}
+
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
Share Link
+
+
+
+
+
+
+
+
+
+ Share with Users
+
+ {% for user in users %}
+ {{ user.get_full_name }}
+ {% endfor %}
+
+
+
+
+ Message (Optional)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ template.name }}
+
How would you rate this template?
+
+
+
+
+
+
+
+
+
+
+
+ Click to rate
+
+
+
+
+ Review (Optional)
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+
+
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/templates/surgical_note_template_form.html b/templates/operating_theatre/templates/surgical_note_template_form.html
new file mode 100644
index 00000000..4860317b
--- /dev/null
+++ b/templates/operating_theatre/templates/surgical_note_template_form.html
@@ -0,0 +1,1162 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}{% if template.pk %}Edit{% else %}Create{% endif %} Surgical Note Template{% endblock %}
+
+{% block extra_css %}
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+ Auto-saved
+
+
+
+
+
+
+
+
+ {% csrf_token %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Validate
+
+
+ Test
+
+
+
+
+
+ Cancel
+
+
+ Save Draft
+
+
+
+ {% if template.pk %}Update Template{% else %}Create Template{% endif %}
+
+
+
+
+
+
+
+
+
+
+ Available Variables
+
+
+
+
{{patient_name}}
+
Patient's full name
+
+
+
+
+
+
+
{{patient_id}}
+
Patient ID number
+
+
+
+
+
+
+
{{surgery_date}}
+
Date of surgery
+
+
+
+
+
+
+
{{surgeon_name}}
+
Primary surgeon name
+
+
+
+
+
+
+
{{procedure_name}}
+
Name of procedure
+
+
+
+
+
+
+
{{anesthesia_type}}
+
Type of anesthesia
+
+
+
+
+
+
+
{{start_time}}
+
Surgery start time
+
+
+
+
+
+
+
{{end_time}}
+
Surgery end time
+
+
+
+
+
+
+
{{current_date}}
+
Current date
+
+
+
+
+
+
+
{{current_time}}
+
Current time
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+
+
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/templates/surgical_note_template_list.html b/templates/operating_theatre/templates/surgical_note_template_list.html
new file mode 100644
index 00000000..210a66fd
--- /dev/null
+++ b/templates/operating_theatre/templates/surgical_note_template_list.html
@@ -0,0 +1,941 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Surgical Note Templates{% endblock %}
+
+{% block extra_css %}
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
{{ stats.total_templates|default:0 }}
+
Total Templates
+
+
+
+
+
+
+
{{ stats.active_templates|default:0 }}
+
Active Templates
+
+
+
+
+
+
+
{{ stats.popular_templates|default:0 }}
+
Popular Templates
+
+
+
+
+
+
+
{{ stats.usage_this_month|default:0 }}
+
Used This Month
+
+
+
+
+
+
+
+ Category
+
+ All Categories
+ General Surgery
+ Cardiac Surgery
+ Orthopedic Surgery
+ Neurosurgery
+ Plastic Surgery
+ Emergency Surgery
+ Pediatric Surgery
+ Other
+
+
+
+ Status
+
+ All Statuses
+ Active
+ Inactive
+ Draft
+
+
+
+ Created By
+
+ All Authors
+ {% for author in authors %}
+ {{ author.get_full_name }}
+ {% endfor %}
+
+
+
+ Sort By
+
+ Name
+ Date Created
+ Last Updated
+ Usage Count
+ Popularity
+
+
+
+
+
+
+
+
+ Apply
+
+
+ Clear
+
+
+
+
+
+
+
+
+
+
+
+ {% for template in templates %}
+
+
+
+
+
+
{{ template.description|truncatewords:20 }}
+
+
+
+ {% if template.tags.all %}
+
+ {% for tag in template.tags.all %}
+ {{ tag.name }}
+ {% endfor %}
+
+ {% endif %}
+
+
+
+ This Month
+ {{ template.usage_this_month|default:0 }}
+
+
+
+
+
+
+
+
+ {% empty %}
+
+
+
+
No Templates Found
+
Create your first surgical note template to get started
+
+ Create Template
+
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Template Name
+ Category
+ Status
+ Created By
+ Usage Count
+ Last Updated
+ Actions
+
+
+
+ {% for template in templates %}
+
+
+
+
+
+
+ {{ template.name }}
+ {{ template.description|truncatewords:10 }}
+
+
+
+
+ {{ template.get_category_display }}
+
+
+
+
+ {{ template.get_status_display }}
+
+
+ {{ template.created_by.get_full_name }}
+
+
+ {{ template.usage_count|default:0 }}
+ {{ template.usage_this_month|default:0 }} this month
+
+
+
+ {{ template.updated_at|date:"M d, Y" }}
+ {{ template.updated_at|time:"g:i A" }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {% if template.status != 'active' %}
+
+
+
+ {% endif %}
+
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% csrf_token %}
+
+
Template File
+
+
Supported formats: JSON, XML, TXT
+
+
+
+
+
+ Overwrite existing templates with same name
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+
+
+
+
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/templates/template_confirm_delete.html b/templates/operating_theatre/templates/template_confirm_delete.html
new file mode 100644
index 00000000..fa648b51
--- /dev/null
+++ b/templates/operating_theatre/templates/template_confirm_delete.html
@@ -0,0 +1,603 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Delete Template - {{ template.name }}{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+ Template Information
+
+
+
+
Template Name
+
{{ template.name }}
+
+
+
Specialty
+
{{ template.get_specialty_display }}
+
+
+
Complexity
+
{{ template.get_complexity_display }}
+
+
+
Status
+
+ {% if template.status == 'active' %}
+ Active
+ {% elif template.status == 'draft' %}
+ Draft
+ {% elif template.status == 'under_review' %}
+ Under Review
+ {% elif template.status == 'archived' %}
+ Archived
+ {% endif %}
+
+
+
+
Created By
+
{{ template.created_by.get_full_name }}
+
+
+
Created Date
+
{{ template.created_at|date:"M d, Y" }}
+
+
+
Total Uses
+
{{ template.usage_count|default:0 }}
+
+
+
Last Used
+
{{ template.last_used|date:"M d, Y"|default:"Never" }}
+
+
+
+
+
+ {% if blocking_conditions %}
+
+
+ Cannot Delete Template
+
+
This template cannot be deleted due to the following conditions:
+
+ {% for condition in blocking_conditions %}
+ {{ condition }}
+ {% endfor %}
+
+
+
+ {% else %}
+
+
+
+
+ Warning
+
+
+ Deleting this template will permanently remove all associated data including procedure steps,
+ equipment requirements, and team configurations. This action cannot be undone.
+
+
+
+
+
+
+
+
+
+
+
+
+
Procedure Steps
+
+ {{ template.procedure_steps.count }} procedure steps will be permanently deleted
+
+
+
+
+
+
+
+
+
+
Equipment Requirements
+
+ {{ template.equipment_list.count }} equipment requirements will be removed
+
+
+
+
+
+
+
+
+
+
Team Requirements
+
+ {{ template.team_requirements.count }} team member requirements will be removed
+
+
+
+
+ {% if template.active_cases.count > 0 %}
+
+
+
+
+
+
Active Cases
+
+ {{ template.active_cases.count }} active surgical cases are using this template
+
+
+
+ {% endif %}
+
+ {% if template.scheduled_cases.count > 0 %}
+
+
+
+
+
+
Scheduled Cases
+
+ {{ template.scheduled_cases.count }} scheduled cases reference this template
+
+
+
+ {% endif %}
+
+
+
+
+
+
+ Alternative Actions
+
+
Consider these alternatives instead of permanent deletion:
+
+
+
+
+
+
+ Archive Template
+ Hide template but preserve data for reference
+
+
+
+
+
+
+
+ Deactivate Template
+ Prevent new uses while keeping existing data
+
+
+
+
+
+
+
+
+
+
+ Export Template
+ Create backup before deletion
+
+
+
+
+
+
+
+ Transfer Ownership
+ Assign template to another user
+
+
+
+
+
+
+
+
+
+ Deletion Confirmation
+
+
+
+ {% csrf_token %}
+
+
+
+ Type the template name to confirm deletion:
+
+
+
+ This helps prevent accidental deletions
+
+
+
+
+ Reason for Deletion
+
+ Select reason...
+ Template is obsolete
+ Duplicate template
+ Incorrect information
+ Replaced by newer template
+ No longer used
+ Other
+
+
+
+
+ Additional Notes
+
+
+
+
+
+
+ Notify users who have used this template
+
+
+
+
+
+
+ Create backup before deletion
+
+
+
+
+
+ Cancel
+
+
+ Delete Template Permanently
+
+
+
+
+ {% endif %}
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/templates/template_detail.html b/templates/operating_theatre/templates/template_detail.html
new file mode 100644
index 00000000..d6c57485
--- /dev/null
+++ b/templates/operating_theatre/templates/template_detail.html
@@ -0,0 +1,628 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}{{ template.name }} - Surgical Template{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+ Export
+
+
+
+
+ Edit
+
+
+ Use Template
+
+
+
+
+
+
+
+
+
+
+ Usage Statistics
+
+
+
+
{{ usage_stats.total_uses }}
+
Total Uses
+
+
+
{{ usage_stats.this_month }}
+
This Month
+
+
+
{{ usage_stats.avg_duration }}
+
Avg Duration (min)
+
+
+
{{ usage_stats.success_rate }}%
+
Success Rate
+
+
+
+
+
+
+
+
+
+
+
Procedure Type
+
{{ template.get_procedure_type_display }}
+
+
+
Estimated Duration
+
{{ template.estimated_duration }} minutes
+
+
+
Required Team Size
+
{{ template.required_team_size }} members
+
+
+
Anesthesia Type
+
+ {% if template.anesthesia_type %}
+ {{ template.get_anesthesia_type_display }}
+ {% else %}
+ Not specified
+ {% endif %}
+
+
+
+
Patient Position
+
{{ template.patient_position|default:"Not specified" }}
+
+
+
Room Requirements
+
{{ template.room_requirements|default:"Standard OR" }}
+
+
+
+
+
+
+
+
+
+ {% for step in template.procedure_steps.all %}
+
+
+
+ {{ step.description }}
+
+ {% if step.critical_points %}
+
+
+
+ Critical Points: {{ step.critical_points }}
+
+
+ {% endif %}
+
+ {% empty %}
+
+
+
No procedure steps defined
+
+ {% endfor %}
+
+
+
+
+
+
+
+ {% for equipment in template.equipment_list.all %}
+
+
+
+
+
+
{{ equipment.name }}
+
+ {{ equipment.category|title }} |
+ Quantity: {{ equipment.quantity|default:1 }} |
+ {% if equipment.is_critical %}
+ Critical
+ {% else %}
+ Standard
+ {% endif %}
+
+
+ {% if equipment.alternatives %}
+
+
+
+ Alternatives: {{ equipment.alternatives }}
+
+
+ {% endif %}
+
+ {% empty %}
+
+
+
No equipment requirements defined
+
+ {% endfor %}
+
+
+
+
+
+
+
+ {% for member in template.team_requirements.all %}
+
+
+ {{ member.role|first|upper }}
+
+
+
{{ member.get_role_display }}
+
+ {% if member.specialization %}
+ Specialization: {{ member.specialization }} |
+ {% endif %}
+ Experience: {{ member.min_experience_years|default:"Any" }} years
+ {% if member.certifications_required %}
+ | Certifications: {{ member.certifications_required }}
+ {% endif %}
+
+
+
+ {{ member.count|default:1 }}
+
+
+ {% empty %}
+
+
+
No team requirements defined
+
+ {% endfor %}
+
+
+
+
+ {% if template.preop_requirements %}
+
+
+
+
+
+
Patient Preparation
+
+ {% for req in template.preop_requirements.patient_prep %}
+
+ {{ req }}
+
+ {% endfor %}
+
+
+
+
Required Tests
+
+ {% for test in template.preop_requirements.required_tests %}
+
+ {{ test }}
+
+ {% endfor %}
+
+
+
+
+
+ {% endif %}
+
+
+ {% if template.postop_care %}
+
+
+
+
+
+
Immediate Care
+
+ {% for care in template.postop_care.immediate %}
+
+ {{ care }}
+
+ {% endfor %}
+
+
+
+
Recovery Instructions
+
+ {% for instruction in template.postop_care.recovery %}
+
+ {{ instruction }}
+
+ {% endfor %}
+
+
+
+
+
+ {% endif %}
+
+
+ {% if template.notes or template.warnings %}
+
+
+
+ {% if template.warnings %}
+
+
+ Warnings
+
+
{{ template.warnings }}
+
+ {% endif %}
+
+ {% if template.notes %}
+
+
+ Notes
+
+
{{ template.notes }}
+
+ {% endif %}
+
+
+ {% endif %}
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/templates/template_form.html b/templates/operating_theatre/templates/template_form.html
new file mode 100644
index 00000000..d07cc1e8
--- /dev/null
+++ b/templates/operating_theatre/templates/template_form.html
@@ -0,0 +1,816 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}
+ {% if template.pk %}Edit Template - {{ template.name }}{% else %}Create Surgical Template{% endif %}
+{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+ {% csrf_token %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/operating_theatre/templates/template_list.html b/templates/operating_theatre/templates/template_list.html
new file mode 100644
index 00000000..e7404985
--- /dev/null
+++ b/templates/operating_theatre/templates/template_list.html
@@ -0,0 +1,602 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Surgical Templates{% endblock %}
+
+{% block extra_css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
Surgical Template Management
+
Manage standardized surgical procedure templates to ensure consistency and efficiency in the operating theatre.
+
+
+
+
+
+
+
+
+
+
{{ stats.total_templates }}
+
Total Templates
+
+
+
{{ stats.active_templates }}
+
Active Templates
+
+
+
{{ stats.used_this_month }}
+
Used This Month
+
+
+
{{ stats.pending_review }}
+
Pending Review
+
+
+
+
+
+
+
+
+
+
+ Filters
+
+
+ Clear
+
+
+
+
+
+
+
+
+
+
+
+ Specialty
+
+ All Specialties
+ General Surgery
+ Orthopedic
+ Cardiac
+ Neurosurgery
+ Plastic Surgery
+ Urology
+ Gynecology
+ Ophthalmology
+ ENT
+ Vascular
+
+
+
+ Status
+
+ All Statuses
+ Active
+ Draft
+ Under Review
+ Archived
+
+
+
+ Complexity
+
+ All Complexities
+ Simple
+ Moderate
+ Complex
+ Highly Complex
+
+
+
+ Duration Range
+
+ All Durations
+ 0-60 minutes
+ 1-2 hours
+ 2-4 hours
+ 4+ hours
+
+
+
+
+
+
+ Apply Filters
+
+
+
+
+
+
+
+
+ {% for template in templates %}
+
+
+
+
+ {{ template.description|truncatewords:20 }}
+
+
+
+
+ {{ template.get_complexity_display }}
+
+ {% if template.requires_anesthesia %}
+
+ Anesthesia Required
+
+ {% endif %}
+ {% if template.is_emergency_procedure %}
+
+ Emergency
+
+ {% endif %}
+
+ {{ template.get_usage_frequency_display }} Usage
+
+
+
+
+
+
Equipment Items:
+
{{ template.equipment_list.count }}
+
+
+
Team Members:
+
{{ template.required_team_size }}
+
+
+
+
+
+ {% empty %}
+
+
+
+
No surgical templates found
+
Create your first surgical template to standardize procedures.
+
+ Create Template
+
+
+
+ {% endfor %}
+
+
+
+ {% if is_paginated %}
+
+
+
+ {% endif %}
+
+{% endblock %}
+
+{% block extra_js %}
+
+{% endblock %}
+
diff --git a/templates/patients/dashboard.html b/templates/patients/dashboard.html
new file mode 100644
index 00000000..2509c942
--- /dev/null
+++ b/templates/patients/dashboard.html
@@ -0,0 +1,1186 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block title %}Patients Dashboard{% endblock %}
+
+{% block extra_css %}
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+
{{ stats.total_patients|default:0 }}
+
Total Patients
+
+ +{{ stats.new_patients_today|default:0 }} today
+
+
+
+
+
+
+
+
{{ stats.active_patients|default:0 }}
+
Active Patients
+
+ {{ stats.active_change|default:0 }}% this week
+
+
+
+
+
+
+
+
{{ stats.admitted_patients|default:0 }}
+
Currently Admitted
+
+ {{ stats.admission_change|default:0 }} from yesterday
+
+
+
+
+
+
+
+
{{ stats.critical_patients|default:0 }}
+
Critical Condition
+
+ {{ stats.critical_change|default:0 }} from last hour
+
+
+
+
+
+
+
+
{{ stats.appointments_today|default:0 }}
+
Appointments Today
+
+ {{ stats.completed_appointments|default:0 }} completed
+
+
+
+
+
+
+
+
{{ stats.new_registrations|default:0 }}
+
New Registrations
+
+ This week
+
+
+
+
+
+ {% if alerts %}
+
+
+ Patient Alerts & Notifications
+
+ {% for alert in alerts %}
+
+
+
+
+
+
{{ alert.title }}
+
{{ alert.message }}
+
+
{{ alert.created_at|timesince }} ago
+
+ {% endfor %}
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ stats.outpatients|default:0 }}
+
Outpatients
+
+
+
{{ stats.inpatients|default:0 }}
+
Inpatients
+
+
+
{{ stats.emergency|default:0 }}
+
Emergency
+
+
+
{{ stats.icu|default:0 }}
+
ICU
+
+
+
{{ stats.discharged_today|default:0 }}
+
Discharged Today
+
+
+
{{ stats.readmissions|default:0 }}
+
Readmissions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% for activity in recent_activities %}
+
+
+ {{ activity.patient.first_name.0|default:"P" }}{{ activity.patient.last_name.0|default:"" }}
+
+
+
{{ activity.patient.get_full_name }}
+
{{ activity.description }}
+
{{ activity.created_at|timesince }} ago
+
+
+ {{ activity.get_activity_type_display }}
+
+
+ {% empty %}
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+ {% for appointment in todays_appointments %}
+
+
+
{{ appointment.scheduled_time|time:"g:i A" }}
+
{{ appointment.duration }} min
+
+
+
{{ appointment.patient.get_full_name }}
+
{{ appointment.appointment_type }} - {{ appointment.doctor.get_full_name }}
+
+
+
+ {{ appointment.get_status_display }}
+
+
+
+ {% empty %}
+
+
+
No appointments scheduled for today
+
+ {% endfor %}
+
+
+
+
+
+
+
+ {% for patient in critical_patients %}
+
+
+ {{ patient.first_name.0 }}{{ patient.last_name.0 }}
+
+
+
{{ patient.get_full_name }}
+
{{ patient.current_condition }}
+
+ {{ patient.current_location }}
+
+
+
+
+ {% empty %}
+
+
+
No critical patients at this time
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+
+
{{ stats.avg_stay_duration|default:0 }}
+
Avg Stay (days)
+
+
+
{{ stats.satisfaction_rate|default:0 }}%
+
Satisfaction Rate
+
+
+
{{ stats.readmission_rate|default:0 }}%
+
Readmission Rate
+
+
+
{{ stats.bed_occupancy|default:0 }}%
+
Bed Occupancy
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block extra_js %}
+
+
+
+
+
+{% endblock %}
+