I\'m using django modeltranslation for a multi-language site.
Language fallback works good when reading attributes directly. For example, if current language is Germ
The thing to do here is to explicitly query the desire language. In your case:
from django.db.models import Q
# ...
# define your query like this:
results = MyModel.objects.filter(Q(title_de = 'hello') | Q(title_en = 'hello'))
# supposing you have German and English languages set
Why this work? Because when you query the specific language, ModelTranslation keep it. Otherwise it use the current language.
I hope it helps!
You must ensure that your model is registered in translation.py
from modeltranslation.translator import register, TranslationOptions
@register(YourModel)
class YourModel(TranslationOptions):
pass
In this way all the queries that are done will return the appropriate field depending on the language in which it is, this because to register it is created a MultilingualManager