Learn Wagtail Course
Customizing Default Property Values
Below is the exact code you'll find in this Git Commit.
class HomePage(Page): ... # This will change the "title" field 's verbose name to "Custom Name". # But you'd still reference it in the template as `page.title` HomePage._meta.get_field("title").verbose_name = "Custom Name" # Here we are removing the help text. But to change it, simply change None to a string. HomePage._meta.get_field("title").help_text = None # Below is the new default title for a Home Page. # This only appears when you create a new page. HomePage._meta.get_field("title").default = "Default HomePage Title" # Lastly, we're adding a default `slug` value to the page. # This does not need to reflect the same (or similar) value that the `title` field has. HomePage._meta.get_field("slug").default = "default-homepage-title"
The Git Commit
Was this helpful to you?
Sharing is caring. Help the community by sharing this article.