Skip to content

Commit

Permalink
fix: append media url to certificate paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Adibov committed Jan 11, 2024
1 parent d70115c commit 8e76266
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/backend_api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(urllib.parse.urljoin(BASE_URL, MEDIA_URL), val)
continue
response["id"] = val
try:
Expand Down Expand Up @@ -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(urllib.parse.urljoin(BASE_URL, MEDIA_URL), val)
continue
response["id"] = val
try:
Expand Down

0 comments on commit 8e76266

Please sign in to comment.