Search code examples
wagtailwagtail-admin

How is `class Blog(page)` linked to a specific `Page` in Wagtail CMS GUI?


I do understand how the routing of Wagtail works when a HTTP request arrives.

  1. site matching via hostname and port
  2. find the specific page via slug settings on Wagtail CMS GUI
  3. serve() of that specific page will be called

However, above routing mechanism does not touch the class in models.py yet. If I have below settings in models.py of django which is integrated with Wagtail,

class BlogList(RoutablePageMixin, Page):
    template = "Post_List.html"
    intro = RichTextField(blank=True)
    content_panels = Page.content_panels + [
        FieldPanel("intro")
        ]

    subpage_types = [
        "BlogDetail",
    ]

    parent_page_type = [
        "HomePage",
    ]

How do I know this class BlogList is linked to which page on Wagtail CMS GUI ?


Solution

  • BlogList is a subclass of Page, meaning that it extends the Page class, with your extra database fields (intro in this case).

    In the CMS, there is a "Type" column on the page listings (at a URL like /admin/pages/1/), which will show you the most-specific class of each page - Unless you specify a name for a page type with Meta.verbose_name, it will automatically convert the class name into a sentence - "Blog list" for your example.