0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 03:31:04 +01:00

get_siblings now defaults to inclusive=True

This commit is contained in:
Karl Hobley 2014-04-08 16:52:57 +01:00
parent 95bb84dd0e
commit d569edc136
2 changed files with 4 additions and 4 deletions

View File

@ -564,7 +564,7 @@ class Page(MP_Node, ClusterableModel, Indexed):
def get_descendants(self, inclusive=False):
return Page.objects.descendant_of(self, inclusive)
def get_siblings(self, inclusive=False):
def get_siblings(self, inclusive=True):
return Page.objects.sibling_of(self, inclusive)

View File

@ -84,7 +84,7 @@ class PageQuerySet(MP_NodeQuerySet):
def not_parent_of(self, other):
return self.exclude(self.parent_of_q(other))
def sibling_of_q(self, other, inclusive=False):
def sibling_of_q(self, other, inclusive=True):
q = Q(path__startswith=self.model._get_parent_path_from_path(other.path)) & Q(depth=other.depth)
if not inclusive:
@ -92,10 +92,10 @@ class PageQuerySet(MP_NodeQuerySet):
return q
def sibling_of(self, other, inclusive=False):
def sibling_of(self, other, inclusive=True):
return self.filter(self.sibling_of_q(other, inclusive))
def not_sibling_of(self, other, inclusive=False):
def not_sibling_of(self, other, inclusive=True):
return self.exclude(self.sibling_of_q(other, inclusive))
def type_q(self, model):