Created
July 21, 2018 23:06
-
-
Save KalobTaulien/b56accf20f64f4991fe174469053c0f9 to your computer and use it in GitHub Desktop.
Wagtail 2: Adding a Banner Mixin to your Wagtail Pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""Page's models.""" | |
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel | |
from wagtail.core.models import Page | |
from .banner import Banner | |
class CustomPage(Page, Banner): | |
"""A bare page class.""" | |
template = "templates/custom_page.html" | |
# Content panels | |
content_panels = [ | |
FieldPanel("title", classname="full title"), | |
MultiFieldPanel(Banner.panels, heading="Banner"), | |
# ...Other panels, if you wish... | |
] | |
class Meta: | |
"""Meta Information.""" | |
verbose_name = "Your Custom Page" | |
verbose_name_plural = "Your Custom Pages" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment