Search code examples
wagtailwagtail-admin

Why duplicated "title" textbox on Wagtail Admin portal?


with below customized Page model,

class PostDetail(Page):
    body = RichTextField(blank=True)

    search_fields = Page.search_fields + [
        index.SearchField("body"),
    ]

    content_panels = Page.content_panels + [
        FieldPanel("title"),
        FieldPanel("body"),
    ]

I did not add title = models.Char() because PostDetail will inherit all attributes (including title) from wagtail built-in Page model.

But when I tried to add a Post Detail page, I saw duplicated title fields. why is that? enter image description here


Solution

  • FieldPanel("title") is already defined in Page.content_panels, so Page.content_panels + [FieldPanel("title")] defines it twice.