mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 16:53:10 +00:00
return a queryset instead of the first sibling
This commit is contained in:
parent
6ce38148b0
commit
733294cafa
2 changed files with 6 additions and 6 deletions
|
|
@ -645,11 +645,11 @@ class Page(MP_Node, ClusterableModel, Indexed):
|
|||
def get_siblings(self, inclusive=True):
|
||||
return Page.objects.sibling_of(self, inclusive)
|
||||
|
||||
def get_next_published_sibling(self):
|
||||
return self.get_siblings().live().filter(path__gt=self.path).order_by('path').first()
|
||||
def get_next_siblings(self):
|
||||
return self.get_siblings().filter(path__gt=self.path).order_by('path')
|
||||
|
||||
def get_prev_published_sibling(self):
|
||||
return self.get_siblings().live().filter(path__lt=self.path).order_by('-path').first()
|
||||
def get_prev_siblings(self):
|
||||
return self.get_siblings().filter(path__lt=self.path).order_by('-path')
|
||||
|
||||
def get_navigation_menu_items():
|
||||
# Get all pages that appear in the navigation menu: ones which have children,
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ class TestPageQuerySet(TestCase):
|
|||
# All pages must be live
|
||||
while current_page:
|
||||
self.assertTrue(current_page.live)
|
||||
current_page = current_page.get_next_published_sibling()
|
||||
current_page = current_page.get_next_siblings().live().first()
|
||||
|
||||
def test_published_prev(self):
|
||||
events_index = Page.objects.get(url_path='/home/events/')
|
||||
|
|
@ -271,4 +271,4 @@ class TestPageQuerySet(TestCase):
|
|||
# All pages must be live
|
||||
while current_page:
|
||||
self.assertTrue(current_page.live)
|
||||
current_page = current_page.get_prev_published_sibling()
|
||||
current_page = current_page.get_prev_siblings().live().first()
|
||||
|
|
|
|||
Loading…
Reference in a new issue