mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 08:43:10 +00:00
made published siblings a single query
This commit is contained in:
parent
de678ac8ba
commit
4d6db52f99
1 changed files with 2 additions and 12 deletions
|
|
@ -650,20 +650,10 @@ class Page(MP_Node, ClusterableModel, Indexed):
|
|||
return Page.objects.sibling_of(self, inclusive)
|
||||
|
||||
def get_next_published_sibling(self):
|
||||
next_sibling = self.get_next_sibling()
|
||||
|
||||
while next_sibling and not next_sibling.live:
|
||||
next_sibling = next_sibling.get_next_sibling()
|
||||
|
||||
return next_sibling
|
||||
return self.get_siblings().live().filter(path__gt=self.path).order_by('path').first()
|
||||
|
||||
def get_prev_published_sibling(self):
|
||||
prev_sibling = self.get_prev_sibling()
|
||||
|
||||
while prev_sibling and not prev_sibling.live:
|
||||
prev_sibling = prev_sibling.get_prev_sibling()
|
||||
|
||||
return prev_sibling
|
||||
return self.get_siblings().live().filter(path__lt=self.path).order_by('-path').first()
|
||||
|
||||
def get_navigation_menu_items():
|
||||
# Get all pages that appear in the navigation menu: ones which have children,
|
||||
|
|
|
|||
Loading…
Reference in a new issue