Question

I am using django-modeltranslation for translation of my content.

If the value of a translated field is not set for a language then it automatically takes the value of the default language.

However, is there a way to know if value for a given language has been set?

If for example title_fr is not set, obj.title_fr will return the value of obj.title. How to know if the french version has been defined?

Was it helpful?

Solution

You can access original field value with instance.__dict__['title_fr'].

However, you probably want to customize fallback_values option:

https://django-modeltranslation.readthedocs.org/en/latest/usage.html#fallback-values

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top