From 71a2dba4806134f1a4479cb42ea81052b93476eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 6 Sep 2013 23:19:51 +0200 Subject: [PATCH] Use also __name__ for comparison --- proteus/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proteus/__init__.py b/proteus/__init__.py index 4af05d6e8b..49a29996ff 100644 --- a/proteus/__init__.py +++ b/proteus/__init__.py @@ -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