Making the query actually get called for get

This commit is contained in:
James Punteney 2010-01-16 13:24:10 -05:00
parent c38faebc25
commit 47e4dd40cd

View File

@ -295,11 +295,12 @@ class QuerySet(object):
return mongo_query
def get(self):
def get(self, *q_objs, **query):
"""Retrieve the the matching object raising
'MultipleObjectsReturned' or 'DoesNotExist' exceptions
if multiple or no results are found.
"""
self.__call__(*q_objs, **query)
count = self.count()
if count == 1:
return self[0]