danielmwai
danielmwai

Reputation: 303

Wagtail PageQuerySet Querying

I have an NewsIndexPage and a NewsPage , on the Wagtail Admin using NewsIndexPage i have created a tree node where i have NewsIndexPage-->Corporate(this is NewsIndexPage) and i have Travel (NewsInndexPage) like this Corporate-->Travel--> News Stories

I can query as so NewsPage.objects.live().order_by('-last_published_at') how can i query and display stories from Travel i have done so NewsPage.objects.live().filter(slug='corporate').order_by('-last_published_at') but how can i do that for Travel as NewsPage.objects.live().filter(slug='travel').order_by('-last_published_at') --- this doesnt work , how can i filter and get all pages on the Travel -->NewsPage(This holds the news stories)

Upvotes: 1

Views: 312

Answers (1)

Preston Horn
Preston Horn

Reputation: 231

This should work: NewsIndexPage.objects.get(slug='travel').get_children()

Upvotes: 1

Related Questions