This commit is contained in:
Jeff Balogh 2010-06-18 11:24:53 -07:00
Родитель 953f8bbf2a
Коммит 69944ab486
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -46,7 +46,7 @@
{%- if api_version >= 1.5 -%} {%- if api_version >= 1.5 -%}
<previews> <previews>
{%- for preview in addon.previews.all() -%} {%- for preview in addon.previews.all() -%}
<preview primary="{{ preview.highlight }}"> <preview primary="{{ preview.highlight|int }}">
<full type="{{ preview.filetype }}"> <full type="{{ preview.filetype }}">
{{ preview.image_url|urlparams(src='api') }} {{ preview.image_url|urlparams(src='api') }}
</full> </full>

Просмотреть файл

@ -5,6 +5,7 @@ from django.utils import translation
import multidb import multidb
from translations.models import Translation from translations.models import Translation
from translations.fields import TranslatedField
isnull = """IF(!ISNULL({t1}.localized_string), {t1}.{col}, {t2}.{col}) isnull = """IF(!ISNULL({t1}.localized_string), {t1}.{col}, {t2}.{col})
AS {name}_{col}""" AS {name}_{col}"""
@ -24,6 +25,10 @@ def build_query(model, connection):
else: else:
fallback = settings.LANGUAGE_CODE 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. # Add the selects and joins for each translated field on the model.
for field in model._meta.translated_fields: for field in model._meta.translated_fields:
# Add the primary and (possibly) fallback locale parameters. # Add the primary and (possibly) fallback locale parameters.