Commits

Sergiy Kuzmenko  committed 6342c87

get_FIELD_display now works with translated strings

  • Participants
  • Parent commits 3c858f6

Comments (0)

Files changed (2)

File tests/modeltests/models.py

+from django.utils.translation import ugettext_lazy as _
+
 from xdjango.db.models.fields import WeekdaySetField, SetField, DEFAULT_WEEKDAY_CHOICES
 from django.db import models
 
 GAME_CHOICES = (
-    (1, "golf"),
-    (2, "pool"),
-    (4, "chess"),
-    (8, "backgammon")
+    (1, _("golf")),
+    (2, _("pool")),
+    (4, _("chess")),
+    (8, _("backgammon")),
 )
 
 class LimitedWeekdaySetField(WeekdaySetField):

File xdjango/db/models/fields.py

                 
     
     def get_display_value(self, value):
-        return _(", ").join([x[1] for x in filter(lambda x:x[0]&value, self._choices)])
+        return _(", ").join([unicode(x[1]) for x in filter(lambda x:x[0]&value, self._choices)])
         
     
     def get_prep_value(self, value):