Guest User

Untitled

a guest
Aug 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. def __set__(self, instance, value):
  2. """Descriptor for assigning a value to a field in a document.
  3. """
  4. if isinstance(self.field, EmbeddedDocumentField) and:
  5. list_of_docs = list()
  6. for doc in value:
  7. if isinstance(doc, dict):
  8. doc_obj = self.field.document_type_obj(**doc)
  9. doc = doc_obj
  10. list_of_docs.append(doc)
  11. value = list_of_docs
  12. instance._data[self.field_name] = value
Add Comment
Please, Sign In to add comment