Updated docs and added a NotRegistered exception
For handling GenericReferences that reference documents that haven't been imported. Closes #170
This commit is contained in:
@@ -339,7 +339,7 @@ class ListField(BaseField):
|
||||
|
||||
if isinstance(self.field, ReferenceField):
|
||||
referenced_type = self.field.document_type
|
||||
# Get value from document instance if available
|
||||
# Get value from document instance if available
|
||||
value_list = instance._data.get(self.name)
|
||||
if value_list:
|
||||
deref_list = []
|
||||
@@ -522,6 +522,9 @@ class GenericReferenceField(BaseField):
|
||||
"""A reference to *any* :class:`~mongoengine.document.Document` subclass
|
||||
that will be automatically dereferenced on access (lazily).
|
||||
|
||||
note: Any documents used as a generic reference must be registered in the
|
||||
document registry. Importing the model will automatically register it.
|
||||
|
||||
.. versionadded:: 0.3
|
||||
"""
|
||||
|
||||
@@ -648,7 +651,7 @@ class GridFSProxy(object):
|
||||
if not self.newfile:
|
||||
self.new_file()
|
||||
self.grid_id = self.newfile._id
|
||||
self.newfile.writelines(lines)
|
||||
self.newfile.writelines(lines)
|
||||
|
||||
def read(self, size=-1):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user