About Page Panels in Wagtail
In Wagtail, you can organize your fields across these predefined panels:
- Content - for fields that have visual representation in the frontend.
- Promote - for SEO and social sharing options.
- Settings - for feature flags, presentation settings, and other configurations.
To do so, you would put them into one of the following lists:
from wagtail.models import Page
from wagtail.admin.panels import TabbedInterface
class HomePage(Page):
content_panels = Page.content_panels + [...]
promote_panels = Page.promote_panels + [...]
settings_panels = Page.settings_panels + [...]
To add more panels, you would use the TabbedInterface
:
from django.utils.translation import gettext as _
from wagtail.models import Page
from wagtail.admin.panels import TabbedInterface, ObjectList
class HomePage(Page):
# ...
extra_panels = [...]
edit_handler = TabbedInterface([
ObjectList(content_panels, heading=_("Content")),
ObjectList(promote_panels, heading=_("Promote")),
ObjectList(settings_panels, heading=_("Settings")),
ObjectList(extra_panels, heading=_("Extras")),
])
Tips and Tricks Programming Development Django 5.2 Django 4.2 Wagtail 7
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.