wagtail / django understanding pages, link and appropriate data structures

89 Views Asked by At

I am having some trouble trying to understand what data structure to adopt for various data items and how to access them.

Below is my menu structure and page items.

                               Home page
                    /             |                     \
                News            About us               Events
              /  |   \                             /     |     \
      n_item   n_item  n_item               e_item   e_item   e_item

I am using wagtailmenus to generate my header nav bar which works like a charm. All the pages inherit from either Page or MenuePage classes. Now my dilemma is when I want to feature/highlight "n_items" and "e_item" in my homepage maybe like the top 3 news and event items. I can't seem to figure out how to access those pages in my homePage way at the top?

Should I have changed "n_items" to snippets instead and bound them to both my "homepage" and "news" page and same for events ?

Ideally the aim would be to have "n_items" which I can select and they take me directly to that news item and additionally a "view all news" which redirects me to the "News" page.

Keeping in mind I have adopted multi language support using the following ideology

Also i will grant

1

There are 1 best solutions below

0
On

So the answer was pretty straight forward using query sets.

context['news']=Page.objects.type(News)
context['events']=Page.objects.type(Events)

Place that in the get_context function of the page you would like to access that content from.

Follow the examples here