Updated the documents
This commit is contained in:
parent
4b3cea9e78
commit
8ac9e6dc19
2 changed files with 18 additions and 2 deletions
|
|
@ -232,7 +232,7 @@ custom manager methods as you like::
|
|||
BlogPost(title='test1', published=False).save()
|
||||
BlogPost(title='test2', published=True).save()
|
||||
assert len(BlogPost.objects) == 2
|
||||
assert len(BlogPost.live_posts) == 1
|
||||
assert len(BlogPost.live_posts()) == 1
|
||||
|
||||
Custom QuerySets
|
||||
================
|
||||
|
|
@ -243,11 +243,16 @@ a document, set ``queryset_class`` to the custom class in a
|
|||
:class:`~mongoengine.Document`\ s ``meta`` dictionary::
|
||||
|
||||
class AwesomerQuerySet(QuerySet):
|
||||
pass
|
||||
|
||||
def get_awesome(self):
|
||||
return self.filter(awesome=True)
|
||||
|
||||
class Page(Document):
|
||||
meta = {'queryset_class': AwesomerQuerySet}
|
||||
|
||||
# To call:
|
||||
Page.objects.get_awesome()
|
||||
|
||||
.. versionadded:: 0.4
|
||||
|
||||
Aggregation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue