Use pk in ReferenceField fixes MongoEngine/mongoengine#85
This commit is contained in:
parent
a0e3f382cd
commit
0bf2ad5b67
@ -774,7 +774,7 @@ class ReferenceField(BaseField):
|
|||||||
|
|
||||||
if isinstance(document, Document):
|
if isinstance(document, Document):
|
||||||
# We need the id from the saved object to create the DBRef
|
# We need the id from the saved object to create the DBRef
|
||||||
id_ = document.id
|
id_ = document.pk
|
||||||
if id_ is None:
|
if id_ is None:
|
||||||
self.error('You can only reference documents once they have'
|
self.error('You can only reference documents once they have'
|
||||||
' been saved to the database')
|
' been saved to the database')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user