Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django modeltranslation - default field?

Django's modeltranslation app is generally a fantastic tool for internationalization. There is, however, one thing that bugs me. When I define my set of languages, modeltranslation generates n fields, one per language. The problem is, I end up with a redundant field (my default language is english).

So I have:

field field_en field_fr field_jp

And field == field_en. Am I misusing modeltranslation, or is there some way to fix this?

EDIT: So to clarify, I'd like to get rid of either field or field_en.

like image 588
arcologies Avatar asked Jun 27 '12 01:06

arcologies


1 Answers

I think you missed the Rules for translated field access in docs, and if you want to remove the main field in admin then see section Django admin backend integration.

And in template file you just have to write the main field like this way

{{obj.field}}

if your current locale is English it will copy the field_en to field and same for the other languages.

like image 175
Ahsan Avatar answered Sep 28 '22 00:09

Ahsan