When using localized list of "choices" for a model field, the admin
doesn't show the translated values in the list view.
Short example:
from django.utils.translation import ugettext_lazy as _
class OrderStates:
STATES = (
(STATE_NEW, _("New")),
(STATE_CANCELLED, _("Cancelled")), )
class Order(models.Model):
state = models.IntegerField(choices=OrderStates.STATES)
# ..
class OrderAdmin(admin.ModelAdmin):
list_display = [ 'id', 'state', 'address', 'user']
# ..
admin.site.register(Order, OrderAdmin)
The localized versions of "New" and "Cancelled" show up correctly in
the front-end and in the admin form when editing an order.
But in the admin list view I get blank fields - regardless of the
language I switch to, including English. Column names are fine.
This only happens with Python 2.3. The choices display correctly
everywhere with Python 2.5. I don't get any errors or warnings in
neither.
Tried using ugettext instead of ugettext_lazy for the options, which
didn't work. ugettext_noop sort of works - it at least shows the
original english versions instead of blank fields.
Am I doing something wrong or is this a bug?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---