1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #25730 -- Made Model.__str__() always return str instances.

Thanks to Kevin Turner for the report and Tim for the review.
This commit is contained in:
Simon Charette
2015-11-11 01:30:19 -05:00
parent 74365585e2
commit 4cd5d846d4
2 changed files with 22 additions and 1 deletions

View File

@@ -463,7 +463,7 @@ class Model(six.with_metaclass(ModelBase)):
def __str__(self):
if six.PY2 and hasattr(self, '__unicode__'):
return force_text(self).encode('utf-8')
return '%s object' % self.__class__.__name__
return str('%s object' % self.__class__.__name__)
def __eq__(self, other):
if not isinstance(other, Model):