diff --git a/django_tables2/columns/base.py b/django_tables2/columns/base.py index e59b41d..d534d66 100644 --- a/django_tables2/columns/base.py +++ b/django_tables2/columns/base.py @@ -1,13 +1,16 @@ # coding: utf-8 from __future__ import absolute_import, unicode_literals -from django.db.models.fields import FieldDoesNotExist -from django_tables2.templatetags.django_tables2 import title -from django_tables2.utils import A, AttributeDict, OrderBy, OrderByTuple from collections import OrderedDict from itertools import islice -import six import warnings +from django.db.models.fields import FieldDoesNotExist +import six + +from django_tables2.templatetags.django_tables2 import title +from django_tables2.utils import A, AttributeDict, OrderBy, OrderByTuple +from ..utils import python_2_unicode_compatible + class Library(object): """ @@ -249,6 +252,7 @@ class Column(object): # pylint: disable=R0902 return cls(verbose_name=verbose_name) +@python_2_unicode_compatible class BoundColumn(object): """ A *run-time* version of `.Column`. The difference between @@ -278,7 +282,7 @@ class BoundColumn(object): self.column = column self.name = name - def __unicode__(self): + def __str__(self): return six.text_type(self.header) @property diff --git a/django_tables2/utils.py b/django_tables2/utils.py index 3d1c2c9..078c7fd 100644 --- a/django_tables2/utils.py +++ b/django_tables2/utils.py @@ -151,7 +151,7 @@ class OrderByTuple(tuple): transformed.append(item) return super(OrderByTuple, cls).__new__(cls, transformed) - def __unicode__(self): + def __str__(self): return ','.join(self) def __contains__(self, name): diff --git a/tests/test_templates.py b/tests/test_templates.py index a65a1b0..27e5b67 100644 --- a/tests/test_templates.py +++ b/tests/test_templates.py @@ -261,7 +261,7 @@ def test_as_html_db_queries(transactional_db): # with queries(count=1): # PersonTable(Person.objects.all()).as_html() - +@pytest.mark.django_db class TestQueries(TransactionTestCase): def test_as_html_db_queries(self): class PersonTable(tables.Table): diff --git a/tox.ini b/tox.ini index b7016c6..87b3895 100644 --- a/tox.ini +++ b/tox.ini @@ -91,5 +91,4 @@ deps = -r{toxinidir}/requirements/django-1.3.x.pip [testenv:py27-dj12] basepython = python2.7 -commands = python -W error {envbindir}/coverage run setup.py test [] deps = -r{toxinidir}/requirements/django-1.2.x.pip