Added 'page' attribute to PageQuerySet

pull/185/head
Karl Hobley 2014-04-07 15:38:02 +01:00
rodzic a8ff69a2b0
commit a307393c2b
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -16,6 +16,15 @@ class PageQuerySet(QuerySet):
def not_live(self):
return self.exclude(self.live_q())
def page_q(self, other):
return Q(id=other.id)
def page(self, other):
return self.filter(self.page_q(other))
def not_page(self, other):
return self.exclude(self.page_q(other))
def descendant_of_q(self, other):
return Q(path__startswith=other.path) & Q(depth__gt=other.depth)