Yan Tian
Yan Tian

Reputation: 397

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

Upvotes: 0

Views: 32

Answers (1)

gasman
gasman

Reputation: 25292

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

Upvotes: 1

Related Questions