1
0
mirror of https://github.com/django/django.git synced 2024-12-25 18:46:22 +00:00

[py3] Avoided returning bytes in Model.__str__

on Python 3.
This commit is contained in:
Aymeric Augustin 2012-08-11 22:15:05 +02:00
parent 9e7b5ba50f
commit dbb63e56ea

View File

@ -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__