mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.9.x] Fixed #25730 -- Made Model.__str__() always return str instances.
Thanks to Kevin Turner for the report and Tim for the review.
Backport of 4cd5d846d4 from master
This commit is contained in:
@@ -464,7 +464,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):
|
||||
|
||||
Reference in New Issue
Block a user