Use also __name__ for comparison

This commit is contained in:
Cédric Krier committed 2013-09-06 23:19:51 +02:00
1 parent 04b26a135c
commit 71a2dba480
1 file changed
+2 -1
+2 -1
View File
@@ -631,7 +631,8 @@ class Model(object):
def __cmp__(self, other):
'Compare with other'
if isinstance(other, Model):
return cmp(self.id, other.id)
return cmp((self.__class__.__name__, self.id),
(other.__class__.__name__, other.id))
if isinstance(other, (bool, NoneType)):
return 1
raise NotImplementedError