diff --git a/docs/building_your_site/djangodevelopers.rst b/docs/building_your_site/djangodevelopers.rst index 4a8f2f1d2..aa6790d13 100644 --- a/docs/building_your_site/djangodevelopers.rst +++ b/docs/building_your_site/djangodevelopers.rst @@ -253,7 +253,65 @@ Examples: .. automodule:: wagtail.wagtailcore.query .. autoclass:: PageQuerySet - :members: + + .. automethod:: live + + .. automethod:: not_live + + .. automethod:: in_menu + + .. note:: + + To put your page in menus, set the show_in_menus flag to true: + + .. code-block:: python + + # Add 'my_page' to the menu + my_page.show_in_menus = True + + .. automethod:: not_in_menu + + .. automethod:: page + + .. note:: + + This will not add the page to the queryset if it doesn't already contain it. + + If you would like to add a page to a queryset, create another queryset with just + that page and combine them with the ``|`` operator: + + .. code-block:: python + + # Force `my_page` into `queryset` + queryset = queryset | Page.objects.page(my_page) + + .. automethod:: not_page + + .. automethod:: descendant_of + + .. automethod:: not_descendant_of + + .. automethod:: child_of + + .. automethod:: not_child_of + + .. automethod:: ancestor_of + + .. automethod:: not_ancestor_of + + .. automethod:: sibling_of + + .. automethod:: not_sibling_of + + .. automethod:: type + + .. automethod:: not_type + + .. automethod:: public + + .. automethod:: not_public + + .. automethod:: search .. _wagtail_site_admin: diff --git a/wagtail/wagtailcore/query.py b/wagtail/wagtailcore/query.py index 801f31f25..b6bf9c911 100644 --- a/wagtail/wagtailcore/query.py +++ b/wagtail/wagtailcore/query.py @@ -27,15 +27,6 @@ class PageQuerySet(MP_NodeQuerySet): def in_menu(self): """ This filters the queryset to only contain pages that are in the menus. - - .. note:: - - To put your page in menus, set the show_in_menus flag to true: - - .. code-block:: python - - # Add 'my_page' to the menu - my_page.show_in_menus = True """ return self.filter(self.in_menu_q()) @@ -48,18 +39,6 @@ class PageQuerySet(MP_NodeQuerySet): def page(self, other): """ This filters the queryset so it only contains the specified page. - - .. note:: - - This will not add the page to the queryset if it doesn't already contain it. - - If you would like to add a page to a queryset, create another queryset with just - that page and combine them with the ``|`` operator: - - .. code-block:: python - - # Force `my_page` into `queryset` - queryset = queryset | Page.objects.page(my_page) """ return self.filter(self.page_q(other))