Added ReferencField handling with .distinct()

Closes #356
This commit is contained in:
Ross Lawley
2011-12-02 06:47:58 -08:00
parent 403977cd49
commit a6948771d8
4 changed files with 26 additions and 4 deletions

View File

@@ -1073,8 +1073,10 @@ class QuerySet(object):
:param field: the field to select distinct values from
.. versionadded:: 0.4
.. versionchanged:: 0.5 - Fixed handling references
"""
return self._cursor.distinct(field)
from dereference import dereference
return dereference(self._cursor.distinct(field), 1)
def only(self, *fields):
"""Load only a subset of this document's fields. ::