Merge pull request #583 from Gerrrr/distinct_bug
Fixed bug in distinct method
This commit is contained in:
		| @@ -717,7 +717,10 @@ class BaseQuerySet(object): | ||||
|             # We may need to cast to the correct type eg. ListField(EmbeddedDocumentField) | ||||
|             doc_field = getattr(self._document._fields.get(field), "field", None) | ||||
|             instance = getattr(doc_field, "document_type", False) | ||||
|             if instance: | ||||
|             EmbeddedDocumentField = _import_class('EmbeddedDocumentField') | ||||
|             GenericEmbeddedDocumentField = _import_class('GenericEmbeddedDocumentField') | ||||
|             if instance and isinstance(doc_field, (EmbeddedDocumentField, | ||||
|                                                    GenericEmbeddedDocumentField)): | ||||
|                 distinct = [instance(**doc) for doc in distinct] | ||||
|             return distinct | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user