summaryrefslogtreecommitdiff
path: root/tests/modeltests/custom_columns
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modeltests/custom_columns')
-rw-r--r--tests/modeltests/custom_columns/models.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/modeltests/custom_columns/models.py b/tests/modeltests/custom_columns/models.py
index 39f1274a8f..16f0563d6b 100644
--- a/tests/modeltests/custom_columns/models.py
+++ b/tests/modeltests/custom_columns/models.py
@@ -18,24 +18,27 @@ from the default generated name, use the ``db_table`` parameter on the
from __future__ import unicode_literals
from django.db import models
+from django.utils.encoding import python_2_unicode_compatible
+@python_2_unicode_compatible
class Author(models.Model):
first_name = models.CharField(max_length=30, db_column='firstname')
last_name = models.CharField(max_length=30, db_column='last')
- def __unicode__(self):
+ def __str__(self):
return '%s %s' % (self.first_name, self.last_name)
class Meta:
db_table = 'my_author_table'
ordering = ('last_name','first_name')
+@python_2_unicode_compatible
class Article(models.Model):
headline = models.CharField(max_length=100)
authors = models.ManyToManyField(Author, db_table='my_m2m_table')
- def __unicode__(self):
+ def __str__(self):
return self.headline
class Meta: