19👍
✅
According to documentation:
Reading the value from the original field returns the value translated to the current language.
This means that tag.name
doesn’t return tag.__dict__['name']
, but rather tag.__dict__['name_en']
(assuming English is an active language).
It looks like you have added modeltranslation to an existing project and you have existing data. In order to get modeltranslation to work properly, you need to run update_translation_fields
, a management command supplied by the app (documentation link). It will copy the data from original field to default translated field (from title
to title_en
).
Source:stackexchange.com