From: Bradley Ayers Date: Sun, 10 Jul 2011 06:56:05 +0000 (+1000) Subject: Fixed issue #13 X-Git-Tag: v0.7.0~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c0958d0f257d84a8fc439b4fc24bdf087b3b1f9c;p=django-tables2.git Fixed issue #13 --- 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')