I use the select box in the model, and when I display it in the template using {{object.get_FIELD_display}}, it always displays in one language .. even if it is translated into a po file.
Here is a simplified version of my code:
models.py
PRODUCT_WEIGHT_UNIT = ( ('to', _('ton')), ('li', _('pound')), ('vg', _(u'vgs³')), ) class ProduitVrac(models.Model): title = models.CharField(_("Title"), max_length=50) unit = models.CharField(max_length=2, choices=PRODUCT_WEIGHT_UNIT)
template
<ul> {% for object in object_list %} <li> <h2>{{ object.title }}</h2> {# The following will not be translated .. #} {{ object.get_unit_display }} </li> {% endfor %} </ul>
Did I miss something?
django
h3.
source share