Tutorial Summary

In this tutorial we are going to learn how to customize default Wagtail Page properties by changing the default help text and field verbose names. We'll also learn how to set a new default field value when you create a new Wagtail Page.

Below is the exact code you'll find in this Git Commit.

class HomePage(Page):
    ...
    # This is your HomePage model
    ...

    
# 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"
Sign up for our newsletter

Get notified about new lessons :)


Our Sites