I'm having some weird bug with gettext while using a ModelSerializer, I cannot get the translated charfield choice for all of the choices, some choices work but others don't I even tried to run another makemessages
command but the same inconsistent result.
this is the problematic field
status= models.CharField(
max_length=50,
default="pending",
choices=[
('pending', _('Pending')),
('initiated', _('Initiated')),
('completed', _('Completed'))
]
)
the solution to this was using get_FieldName_display()
something like this worked correctly:
status = serializers.SerializerMethodField()
def get_status(self, instance):
from django.utils.translation import gettext as _
return _(instance.get_status_display())
this is probably because i'm using windows :)