From dbb63e56eaa6e2e2a574d4327464332b3ef9f970 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 11 Aug 2012 22:15:05 +0200 Subject: [PATCH] [py3] Avoided returning bytes in Model.__str__ on Python 3. --- django/db/models/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/db/models/base.py b/django/db/models/base.py index 569b8e876c..3a569c805a 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -407,7 +407,7 @@ class Model(six.with_metaclass(ModelBase, object)): return smart_bytes('<%s: %s>' % (self.__class__.__name__, u)) def __str__(self): - if hasattr(self, '__unicode__'): + if not six.PY3 and hasattr(self, '__unicode__'): return force_text(self).encode('utf-8') return '%s object' % self.__class__.__name__