Here's my current code:
# get pages
pages = Pages.filter(some filters)
# get a queryset of ancestors
ancestry = current_page.get_ancestors(ascending = True)
# create a queryset of relevant pages
relevant_pages = pages & ancestry
# create a list from this set
page_list = list(relevant_pages)
# extend the list with the children of each
for page in relevant_pages:
page_list.extend(page.get_children() & pages)
pages = page_list
In other words, give a queryset of objects called "pages", and a page called "page", I want to get all the children of each ancestor of "page" that exists in pages.
Is this possible?
Thanks!
Daniele