make EmbeddedDocument not hashable by default (#1528)

This commit is contained in:
Stefan Wójcik
2017-04-30 13:30:21 -04:00
committed by GitHub
parent bd4a603e16
commit 1a3c70ce1b
3 changed files with 35 additions and 15 deletions

View File

@@ -272,13 +272,6 @@ class BaseDocument(object):
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
if getattr(self, 'pk', None) is None:
# For new object
return super(BaseDocument, self).__hash__()
else:
return hash(self.pk)
def clean(self):
"""
Hook for doing document level data cleaning before validation is run.