diff --git a/apps/api/templates/api/includes/addon.xml b/apps/api/templates/api/includes/addon.xml index b895723b80..70e669caf2 100644 --- a/apps/api/templates/api/includes/addon.xml +++ b/apps/api/templates/api/includes/addon.xml @@ -46,7 +46,7 @@ {%- if api_version >= 1.5 -%} {%- for preview in addon.previews.all() -%} - + {{ preview.image_url|urlparams(src='api') }} diff --git a/apps/translations/transformer.py b/apps/translations/transformer.py index 24904a770b..9b54812e80 100644 --- a/apps/translations/transformer.py +++ b/apps/translations/transformer.py @@ -5,6 +5,7 @@ from django.utils import translation import multidb from translations.models import Translation +from translations.fields import TranslatedField isnull = """IF(!ISNULL({t1}.localized_string), {t1}.{col}, {t2}.{col}) AS {name}_{col}""" @@ -24,6 +25,10 @@ def build_query(model, connection): else: fallback = settings.LANGUAGE_CODE + if not hasattr(model._meta, 'translated_fields'): + model._meta.translated_fields = [f for f in model._meta.fields + if isinstance(f, TranslatedField)] + # Add the selects and joins for each translated field on the model. for field in model._meta.translated_fields: # Add the primary and (possibly) fallback locale parameters.