Skip to content

Commit

Permalink
include BASE_URL in image serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
BeritJanssen committed Jun 11, 2024
1 parent 30e641e commit 9cf22fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/theme/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from os.path import join

from django.conf import settings
from django.utils.translation import activate, gettext_lazy as _
from django.utils.translation import gettext_lazy as _

from django_markup.markup import formatter

Expand Down Expand Up @@ -47,8 +47,8 @@ def serialize_theme(theme: ThemeConfig) -> dict:
'description': theme.description,
'headingFontUrl': theme.heading_font_url,
'bodyFontUrl': theme.body_font_url,
'logoUrl': join(settings.MEDIA_URL, str(theme.logo_image.file)) if theme.logo_image else None,
'backgroundUrl': join(settings.MEDIA_URL, str(theme.background_image.file)) if theme.background_image else None,
'logoUrl': f'{settings.BASE_URL.strip("/")}/{settings.MEDIA_URL.strip("/")}/{str(theme.logo_image.file)}' if theme.logo_image else None,
'backgroundUrl': f'{settings.BASE_URL.strip("/")}/{settings.MEDIA_URL.strip("/")}/{str(theme.background_image.file)}' if theme.background_image else None,
'footer': serialize_footer(theme.footer) if hasattr(theme, 'footer') else None,
'header': serialize_header(theme.header) if hasattr(theme, 'header') else None
}

0 comments on commit 9cf22fd

Please sign in to comment.