added queryset chaining via 'filter' method. test included.
This commit is contained in:
@@ -19,6 +19,7 @@ class BaseField(object):
|
||||
self.default = default
|
||||
self.unique = bool(unique or unique_with)
|
||||
self.unique_with = unique_with
|
||||
self._loaded = []
|
||||
|
||||
def __get__(self, instance, owner):
|
||||
"""Descriptor for retrieving a value from a field in a document. Do
|
||||
@@ -68,7 +69,7 @@ class ObjectIdField(BaseField):
|
||||
"""
|
||||
|
||||
def to_python(self, value):
|
||||
return str(value)
|
||||
return unicode(value)
|
||||
|
||||
def to_mongo(self, value):
|
||||
if not isinstance(value, pymongo.objectid.ObjectId):
|
||||
|
||||
@@ -62,6 +62,9 @@ class QuerySet(object):
|
||||
query = QuerySet._transform_query(_doc_cls=self._document, **query)
|
||||
self._query.update(query)
|
||||
return self
|
||||
|
||||
def filter(self, **query):
|
||||
return self.__call__(**query)
|
||||
|
||||
@property
|
||||
def _collection(self):
|
||||
|
||||
Reference in New Issue
Block a user