From c0958d0f257d84a8fc439b4fc24bdf087b3b1f9c Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Sun, 10 Jul 2011 16:56:05 +1000 Subject: [PATCH] Fixed issue #13 --- django_tables2/columns.py | 4 ++-- tests/templates.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/django_tables2/columns.py b/django_tables2/columns.py index d597f4a..d3b159d 100644 --- a/django_tables2/columns.py +++ b/django_tables2/columns.py @@ -331,7 +331,7 @@ class BoundColumn(object): self._name = name def __unicode__(self): - return self.verbose_name + return unicode(self.verbose_name) @property def accessor(self): @@ -416,7 +416,7 @@ class BoundColumn(object): # in anything useful. name = self.name.replace('_', ' ') - # Perhap use a model field's verbose_name + # Try to use a tmodel field's verbose_name if hasattr(self.table.data, 'queryset'): model = self.table.data.queryset.model parts = self.accessor.split('.') diff --git a/tests/templates.py b/tests/templates.py index 8909971..a801c39 100644 --- a/tests/templates.py +++ b/tests/templates.py @@ -5,6 +5,7 @@ from django.conf import settings import django_tables2 as tables from attest import Tests, Assert from xml.etree import ElementTree as ET +from django.utils.translation import ugettext_lazy as _ templates = Tests() @@ -12,7 +13,7 @@ templates = Tests() class CountryTable(tables.Table): name = tables.Column() - capital = tables.Column(sortable=False) + capital = tables.Column(sortable=False, verbose_name=_("Capital")) population = tables.Column(verbose_name='Population Size') currency = tables.Column(visible=False) tld = tables.Column(visible=False, verbose_name='Domain') -- 2.26.2