Fixed EmailField so can add extra validation

(MongoEngine/mongoengine#173, MongoEngine/mongoengine#174, MongoEngine/mongoengine#187)
This commit is contained in:
Ross Lawley
2012-12-10 08:23:41 +00:00
parent 155d79ff4d
commit 6997e02476
4 changed files with 8 additions and 2 deletions

View File

@@ -929,7 +929,7 @@ class QuerySet(object):
if not isinstance(doc, self._document):
msg = "Some documents inserted aren't instances of %s" % str(self._document)
raise OperationError(msg)
if doc.pk:
if doc.pk and not doc._created:
msg = "Some documents have ObjectIds use doc.update() instead"
raise OperationError(msg)
raw.append(doc.to_mongo())