Added __len__ to QuerySet

This commit is contained in:
Harry Marr
2009-12-24 18:45:35 +00:00
parent 9bfe5c7a49
commit 17aef253cb
4 changed files with 17 additions and 13 deletions

View File

@@ -100,6 +100,9 @@ class QuerySet(object):
"""
return self._cursor.count()
def __len__(self):
return self.count()
def limit(self, n):
"""Limit the number of returned documents to `n`. This may also be
achieved using array-slicing syntax (e.g. ``User.objects[:5]``).