W3cubDocs

/Wagtail

Page QuerySet reference

All models that inherit from Page are given some extra QuerySet methods accessible from their .objects attribute.

Examples

Selecting only live pages

live_pages = Page.objects.live()

Selecting published EventPages that are descendants of events_index

events = EventPage.objects.live().descendant_of(events_index)

Getting a list of menu items

# This gets a QuerySet of live children of the homepage with ``show_in_menus`` set
menu_items = homepage.get_children().live().in_menu()

Reference

© 2014-present Torchbox Ltd and individual contributors.
All rights are reserved.
Licensed under the BSD License.
https://docs.wagtail.org/en/stable/reference/pages/queryset_reference.html