Guest User

Untitled

a guest
Jul 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. """Custom Page model(s)."""
  2.  
  3. from wagtail.wagtailadmin.edit_handlers import FieldPanel, MultiFieldPanel, StreamFieldPanel
  4. from wagtail.wagtailcore.fields import StreamField
  5. from wagtail.wagtailcore.models import Page
  6. from wagtail.wagtailsearch import index
  7.  
  8. from .streamfields import * # Replace * with the streamfields you want to use
  9.  
  10.  
  11. class CustomPage(Page):
  12. """A custom page class."""
  13.  
  14. template = 'templates/custom_page.html'
  15. content = StreamField([
  16. ('image_block', ImageBlock()),
  17. ('logo_parade', LogoParadeBlock()),
  18. ('content', RichTextBlock()),
  19. ], null=True)
  20.  
  21. search_fields = Page.search_fields + [
  22. index.SearchField('content'),
  23. ]
  24.  
  25. content_panels = [
  26. MultiFieldPanel([
  27. FieldPanel('title'),
  28. FieldPanel('subtitle'),
  29. ], 'Banner'),
  30. StreamFieldPanel('content'),
  31. ]
Add Comment
Please, Sign In to add comment