From 6be75ec7100da44d3757f5bfcd203d37943066d2 Mon Sep 17 00:00:00 2001 From: Pavlo Mokiichuk Date: Tue, 5 Mar 2024 15:51:07 +0100 Subject: [PATCH] rdi xlsx download template based on program.dct.type --- backend/hct_mis_api/apps/registration_datahub/views.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/hct_mis_api/apps/registration_datahub/views.py b/backend/hct_mis_api/apps/registration_datahub/views.py index ee8de5bf3d..61641123fa 100644 --- a/backend/hct_mis_api/apps/registration_datahub/views.py +++ b/backend/hct_mis_api/apps/registration_datahub/views.py @@ -5,7 +5,7 @@ from django.shortcuts import get_object_or_404 from hct_mis_api.apps.core.models import DataCollectingType -from hct_mis_api.apps.core.utils import get_program_id_from_headers +from hct_mis_api.apps.core.utils import decode_id_string from hct_mis_api.apps.program.models import Program from hct_mis_api.apps.registration_datahub.template_generator import ( TemplateFileGenerator, @@ -13,15 +13,15 @@ def download_template(request: HttpRequest) -> HttpResponse: - program_id = get_program_id_from_headers(request.headers) parse_result = urlparse(request.headers["Referer"]) - business_area_slug = parse_result.path[1:].split("/")[0] + split_url = parse_result.path[1:].split("/") + program_id = decode_id_string(split_url[2]) + business_area_slug = split_url[0] if program_id: program = get_object_or_404(Program, id=program_id) is_program_for_social_worker = program.data_collecting_type.type == DataCollectingType.Type.SOCIAL else: - # TODO change after FE update - is_program_for_social_worker = True + is_program_for_social_worker = False mimetype = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" filename = ( "registration_data_import_template_social_worker.xlsx"