Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2deef44

Browse files
jweyrichmiracle2k
authored andcommitted
Allow non-basestrings (e.g: ugettext_lazy) to be used in verbose_name.
1 parent bf7b453 commit 2deef44

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

django_tables/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.http import Http404
33
from django.core import paginator
44
from django.utils.datastructures import SortedDict
5-
from django.utils.encoding import StrAndUnicode
5+
from django.utils.encoding import force_unicode, StrAndUnicode
66
from django.utils.text import capfirst
77
from columns import Column
88
from options import options
@@ -318,7 +318,8 @@ def _get_values(self):
318318
values = property(_get_values)
319319

320320
def __unicode__(self):
321-
return capfirst(self.column.verbose_name or self.name.replace('_', ' '))
321+
s = self.column.verbose_name or self.name.replace('_', ' ')
322+
return capfirst(force_unicode(s))
322323

323324
def as_html(self):
324325
pass

0 commit comments

Comments
 (0)