Merge pull request #1652 from erdenezul/generic_embedded_query

Subfield resolve error in generic_emdedded_document query #1651
This commit is contained in:
Emmanuel Leblond
2017-11-13 15:29:26 +01:00
committed by GitHub
2 changed files with 32 additions and 0 deletions

View File

@@ -694,6 +694,14 @@ class GenericEmbeddedDocumentField(BaseField):
value.validate(clean=clean)
def lookup_member(self, member_name):
if self.choices:
for choice in self.choices:
field = choice._fields.get(member_name)
if field:
return field
return None
def to_mongo(self, document, use_db_field=True, fields=None):
if document is None:
return None