Skip to content
Snippets Groups Projects
models.py 797 B
Newer Older
  • Learn to ignore specific revisions
  • Todd Dembrey's avatar
    Todd Dembrey committed
    from django.db import models
    
    from wagtail.wagtailadmin.edit_handlers import FieldPanel
    from wagtail.wagtailsearch import index
    from wagtail.wagtailsnippets.edit_handlers import SnippetChooserPanel
    
    
    from opentech.utils.models import BasePage
    
    Todd Dembrey's avatar
    Todd Dembrey committed
        # Only allow creating HomePages at the root level
        parent_page_types = ['wagtailcore.Page']
    
        strapline = models.CharField(blank=True, max_length=255)
        call_to_action = models.ForeignKey('utils.CallToActionSnippet', blank=True, null=True, on_delete=models.SET_NULL, related_name='+')
    
    
        search_fields = BasePage.search_fields + [
    
    Todd Dembrey's avatar
    Todd Dembrey committed
            index.SearchField('strapline'),
        ]
    
    
        content_panels = BasePage.content_panels + [
    
    Todd Dembrey's avatar
    Todd Dembrey committed
            FieldPanel('strapline'),
            SnippetChooserPanel('call_to_action'),
        ]