Use also __name__ for comparison
This commit is contained in:
1 parent
04b26a135c
commit
71a2dba480
1 file changed
+2
-1
+2
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user