From 3001b3c3d3da966f66c72f8e15f37e7b0f775e43 Mon Sep 17 00:00:00 2001 From: Adibov Date: Thu, 11 Jan 2024 18:22:12 +0330 Subject: [PATCH] fix: append media url to certificate paths --- backend/backend_api/serializers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/backend_api/serializers.py b/backend/backend_api/serializers.py index 77c4e01..bbc192a 100644 --- a/backend/backend_api/serializers.py +++ b/backend/backend_api/serializers.py @@ -3,7 +3,7 @@ from django.core.exceptions import ObjectDoesNotExist from rest_framework import serializers, status -from aaiss_backend.settings import BASE_URL +from aaiss_backend.settings import BASE_URL, MEDIA_URL from backend_api import models from backend_api.models import User, Account, WorkshopRegistration, PresentationParticipation from utils.renderers import new_detailed_response @@ -105,7 +105,7 @@ def to_representation(self, instance): for key, val in super_response.items(): if key == 'certificate': if val: - response[key] = urllib.parse.urljoin(BASE_URL, val) + response[key] = urllib.parse.urljoin(BASE_URL, MEDIA_URL, val) continue response["id"] = val try: @@ -144,7 +144,7 @@ def to_representation(self, instance): for key, val in super_response.items(): if key == 'certificate': if val: - response[key] = urllib.parse.urljoin(BASE_URL, val) + response[key] = urllib.parse.urljoin(BASE_URL, MEDIA_URL, val) continue response["id"] = val try: