added natural object comparision
This commit is contained in:
		| @@ -388,3 +388,9 @@ class BaseDocument(object): | |||||||
|         obj = cls(**data) |         obj = cls(**data) | ||||||
|         obj._present_fields = present_fields |         obj._present_fields = present_fields | ||||||
|         return obj |         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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user