diff --git a/backend/config/error_handlers.py b/backend/config/error_handlers.py new file mode 100644 index 0000000000..d02e7e06e2 --- /dev/null +++ b/backend/config/error_handlers.py @@ -0,0 +1,8 @@ +from django.shortcuts import render + + +def handler500(request, template_name="500.html"): + """ + Custom handler for 500s. Ensures the 500 template loads with proper context (environment, login info, OMB values). + """ + return render(request, template_name, {}) diff --git a/backend/config/urls.py b/backend/config/urls.py index 9fe7c0f876..9ab9d939cb 100644 --- a/backend/config/urls.py +++ b/backend/config/urls.py @@ -18,6 +18,8 @@ renderer_classes=[JSONOpenAPIRenderer], ) +handler500 = "config.error_handlers.handler500" + urlpatterns = [ path("api/schema.json", schema_view), path( diff --git a/backend/dissemination/summary_reports.py b/backend/dissemination/summary_reports.py index e2a6448821..f272bf0120 100644 --- a/backend/dissemination/summary_reports.py +++ b/backend/dissemination/summary_reports.py @@ -424,11 +424,12 @@ def gather_report_data_pre_certification(i2d_data): for obj in dissemination_data[model_name]: row = [] for field_name in field_names: - value = getattr(obj, field_name) - # Wipe tzinfo - if isinstance(value, datetime): - value = value.replace(tzinfo=None) - row.append(value) + if not field_name.startswith("_"): + value = getattr(obj, field_name) + # Wipe tzinfo + if isinstance(value, datetime): + value = value.replace(tzinfo=None) + row.append(value) data[model_name]["entries"].append(row) return data