added natural object comparision
This commit is contained in:
parent
bc7e6ccf53
commit
90d9bd9723
1 changed files with 6 additions and 0 deletions
|
|
@ -388,3 +388,9 @@ class BaseDocument(object):
|
|||
obj = cls(**data)
|
||||
obj._present_fields = present_fields
|
||||
return obj
|
||||
|
||||
def __eq__(self, other):
|
||||
assert hasattr(other, 'id'), "You cannot compare two objects of different type."
|
||||
if self.id == other.id:
|
||||
return True
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue