Beispiel #1
0
class ContentPage(Page):
    sub_header = models.CharField(max_length=50, default="")
    body = StreamField([
        ('heading', blocks.CharBlock(icon='title')),
        ('rich_text', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
        ('quote', QuoteBlock()),
        ('table', TableBlock()),
    ])

    content_panels = Page.content_panels + [
        FieldPanel('sub_header'),
        StreamFieldPanel('body'),
    ]
Beispiel #2
0
class HomePage(Page):
    body = StreamField(BucStreamBlock())
    #search_fields = Page.search_fields + [
     #   index.SearchField('body'),
    #]

    api_fields = ['body', 'carousel_items', 'related_links']
        
    class Meta:
        verbose_name = "Homepage"
    
    content_panels = Page.content_panels + [
        FieldPanel('title', classname="full title"),
        StreamFieldPanel('body'),
        InlinePanel('carousel_items', label="Carousel items"),
        InlinePanel('related_links', label="Related links"),

    ]

    def get_context(self, request):
        # Get the published blogs        
        blogs = BlogPage.objects.live().order_by('-first_published_at')
        print(blogs)
        # filter by tags
        main_feature_article = blogs.filter(tags__name='main') #Make sure only one! query_set mainfeature article        
        minitrue = blogs.filter(tags__name='minitrue') #query_set minitrue
        published_media = blogs.filter(tags__name='feature') #query_set published_media
        opinion = blogs.filter(categories__name='Opinion') #query_set opinion-carousell
        cat_pol = blogs.filter(categories__name='Politik') #query_set cat_pol
        cat_econ = blogs.filter(categories__name='Ekonomi') #query_set cat_econ
        cat_cult = blogs.filter(categories__name='Kultur') #query_set cat_cult
        cat_sci = blogs.filter(categories__name='Vetenskap') #query_set cat_sci
        cat_health = blogs.filter(categories__name='Hälsa') #query_set cat_health
        dockyard = blogs.filter(tags__name='Dockyard') #query_set dockyard
        #print(main_feature_article)

        # Update template context
        context = super(HomePage, self).get_context(request)
        context['main_feature_article'] = main_feature_article
        context['minitrue'] = minitrue
        context['published_media'] = published_media
        context['opinion'] = opinion
        context['cat_pol'] = cat_pol
        context['cat_econ'] = cat_econ
        context['cat_cult'] = cat_cult
        context['cat_sci'] = cat_sci
        context['cat_health'] = cat_health
        context['dockyard'] = dockyard

        return context
Beispiel #3
0
class IndustryPage(Page):
    """
    Detail view for a specific industry
    """
    introduction = models.TextField(help_text='Text to describe the page',
                                    blank=True)
    image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+',
        help_text=
        'Landscape mode only; horizontal width between 1000px and 3000px.')
    body = StreamField(BaseStreamBlock(), verbose_name="Page body", blank=True)

    tags = ClusterTaggableManager(through=IndustryPageTag, blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('introduction', classname="full"),
        ImageChooserPanel('image'),
        StreamFieldPanel('body'),
        FieldPanel('tags'),
    ]

    @property
    def get_tags(self):
        """
        Similar to the authors function above we're returning all the tags that
        are related to the blog post into a list we can access on the template.
        We're additionally adding a URL to access BlogPage objects with that tag
        """
        tags = self.tags.all()
        for tag in tags:
            tag.url = '/' + '/'.join(
                s.strip('/')
                for s in [self.get_parent().url, 'tags', tag.slug])
        return tags

    @property
    def get_people(self):
        people = self.people_industries.all()
        return people

    search_fields = Page.search_fields + [
        index.SearchField('body'),
        index.SearchField('tags'),
    ]

    parent_page_types = ['IndustriesIndexPage']
Beispiel #4
0
class HomePage(Page):
    author = models.CharField(max_length=255)
    date = models.DateField("Post date")
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
    ])

    content_panels = Page.content_panels + [
        FieldPanel('author'),
        FieldPanel('date'),
        StreamFieldPanel('body'),
    ]
Beispiel #5
0
class InformationPage(BasePage):
    introduction = models.TextField(blank=True)
    body = StreamField(StoryBlock())

    search_fields = BasePage.search_fields + [
        index.SearchField('introduction'),
        index.SearchField('body'),
    ]

    content_panels = BasePage.content_panels + [
        FieldPanel('introduction'),
        StreamFieldPanel('body'),
        InlinePanel('related_pages', label="Related pages"),
    ]
Beispiel #6
0
class LegacyBlogPage(AbstractFilterPage):
    content = StreamField([
        ('content',
         blocks.RawHTMLBlock(help_text='Content from WordPress unescaped.')),
        ('feedback', v1_blocks.Feedback()),
    ])
    objects = CFGOVPageManager()
    edit_handler = AbstractFilterPage.generate_edit_handler(
        content_panel=StreamFieldPanel('content'))
    template = 'blog/blog_page.html'

    search_fields = AbstractFilterPage.search_fields + [
        index.SearchField('content')
    ]
Beispiel #7
0
class CollectionPage(Page):
    body = stream_factory(null=True, blank=True)
    sidebar_title = models.CharField(max_length=255, null=True, blank=True)

    related_pages = StreamField([
        ('related_pages', blocks.ListBlock(blocks.PageChooserBlock()))
    ], null=True, blank=True)
    sections = StreamField([
        ('section', CollectionList())
    ])
    show_search = models.BooleanField(max_length=255, default=False,
                                    null=False, blank=False,
                                    choices=[
                                        (True, 'Show committee search box'),
                                        (False, 'Do not show committee search box')
                                    ])
    content_panels =  Page.content_panels + [
        StreamFieldPanel('body'),
        FieldPanel('sidebar_title'),
        FieldPanel('show_search'),
        StreamFieldPanel('related_pages'),
        StreamFieldPanel('sections'),
    ]
class HomePage(Page):
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('code', CodeBlock()),
        ('interactive_code', InputCodeBlock()),
        ('image', ImageChooserBlock()),
    ])

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]

    template = 'cs_pages/home_page.jinja2'
Beispiel #9
0
class HomePage(Page):
    parent_page_types = []  # type: List[str]
    subpage_types = []  # type: List[str]

    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
        ('link', blocks.URLBlock()),
    ])

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]
Beispiel #10
0
class AboutUsPage(Page):
    about_org = RichTextField()
    exec_board = StreamField(
        [('exec_board_memeber',
          ListBlock(PeopleBlock(), template='blocks/members.html'))],
        blank=True,
        null=True)

    content_panels = Page.content_panels + [
        FieldPanel('about_org'),
        StreamFieldPanel('exec_board')
    ]
    parent_page_types = ['HomePage']
    subpage_types = []
Beispiel #11
0
class HomePage(Page):
    carousel = StreamField(CarouselBlock(), null=True, blank=True)

    def get_context(self, request):
        context = super(HomePage, self).get_context(request)

        # Add extra variables and return the updated context
        context['cuadernos'] = Cuaderno.objects.all().order_by('nombre')
        context['paginas'] = PaginaDePictos.objects.live().order_by('title')
        return context

    content_panels = Page.content_panels + [
        StreamFieldPanel('carousel'),
    ]
Beispiel #12
0
class Job(ClusterableModel, index.Indexed):
    title = CharField(max_length=255, unique=True)
    background = RichTextField(blank=True)
    responsibilities = RichTextField(blank=True)
    skills = RichTextField(blank=True)
    notes = RichTextField(blank=True)
    location = RichTextField(blank=True)
    benefits = RichTextField(blank=True)
    applying = StreamField([
        ('raw_html',
         RawHTMLBlock(
             help_text=
             'To add Google Analytics to your link, use this template: '
             '<a href="www.example.com" onclick="trackOutboundLink("www.example.com"); return false;">link</a>.'
             '  With great power comes great responsibility. '
             'This HTML is unescaped. Be careful!')),
        ('rich_text', RichTextBlock()),
    ],
                           null=True,
                           blank=True)
    core_technologies = RichTextField(blank=True)
    referrals = RichTextField(blank=True)
    preferred = RichTextField(blank=True)
    qualifications = RichTextField(blank=True)
    experience_we_need = RichTextField(blank=True)

    panels = [
        MultiFieldPanel([
            FieldPanel('title'),
            FieldPanel('background'),
            FieldPanel('responsibilities'),
            FieldPanel('skills'),
            FieldPanel('notes'),
            FieldPanel('location'),
            FieldPanel('core_technologies'),
            FieldPanel('qualifications'),
            FieldPanel('experience_we_need'),
            FieldPanel('preferred'),
            FieldPanel('referrals'),
            FieldPanel('benefits'),
            StreamFieldPanel('applying'),
        ]),
    ]

    class Meta:
        ordering = ['title']

    def __str__(self):
        return '{self.title}'.format(self=self)
Beispiel #13
0
class ContactPage(Page):
    body = StreamField([
        ('big_map', BigMapBlock()),
        ('section', SectionBlock()),
        ('separator', SeparatorBlock()),
    ],
    blank=True,)

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]

    class Meta:
        verbose_name = _('Contact Page')
        verbose_name_plural = _('Contact Pages')
Beispiel #14
0
class LandingPage(CFGOVPage):
    header = StreamField([
        ('hero', molecules.Hero()),
        ('text_introduction', molecules.TextIntroduction()),
    ],
                         blank=True)

    content = StreamField([
        ('image_text_25_75_group', organisms.ImageText2575Group()),
        ('image_text_50_50_group', organisms.ImageText5050Group()),
        ('half_width_link_blob_group', organisms.HalfWidthLinkBlobGroup()),
        ('well', organisms.Well()),
    ],
                          blank=True)

    # General content tab
    content_panels = CFGOVPage.content_panels + [
        StreamFieldPanel('header'),
        StreamFieldPanel('content'),
    ]

    # Tab handler interface
    edit_handler = TabbedInterface([
        ObjectList(content_panels, heading='General Content'),
        ObjectList(CFGOVPage.sidefoot_panels, heading='Sidebar'),
        ObjectList(CFGOVPage.settings_panels, heading='Configuration'),
    ])

    def get_context(self, request, *args, **kwargs):
        return {
            PAGE_TEMPLATE_VAR: self,
            'self': self,
            'request': request,
        }

    template = 'landing-page/index.html'
class SublandingFilterablePage(FilterableFeedPageMixin, base.CFGOVPage):
    header = StreamField([
        ('hero', molecules.Hero()),
    ], blank=True)
    content = StreamField([
        ('text_introduction', molecules.TextIntroduction()),
        ('full_width_text', organisms.FullWidthText()),
        ('filter_controls', organisms.FilterControls()),
        ('featured_content', molecules.FeaturedContent()),
    ])

    # General content tab
    content_panels = CFGOVPage.content_panels + [
        StreamFieldPanel('header'),
        StreamFieldPanel('content'),
    ]

    # Tab handler interface
    edit_handler = TabbedInterface([
        ObjectList(content_panels, heading='General Content'),
        ObjectList(CFGOVPage.sidefoot_panels, heading='Sidebar'),
        ObjectList(CFGOVPage.settings_panels, heading='Configuration'),
    ])

    template = 'sublanding-page/index.html'

    def get_context(self, request, *args, **kwargs):
        context = super(SublandingFilterablePage,
                        self).get_context(request, *args, **kwargs)
        return filterable_context.get_context(self, request, context)

    def get_form_class(self):
        return forms.FilterableListForm

    def get_page_set(self, form, hostname):
        return filterable_context.get_page_set(self, form, hostname)
Beispiel #16
0
class FlatPage(six.with_metaclass(PageBase, MetadataPageMixin, Page)):
    parent_page_types = ['pages.HomePage']
    subpage_types = []

    body = StreamField(BodyStreamBlock())

    search_fields = Page.search_fields + [
        index.SearchField('body'),
    ]

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]

    promote_panels = Page.promote_panels + MetadataPageMixin.panels
Beispiel #17
0
class PublicRawHTMLPage(PublicBasePage):
    """
    A public page for raw HTML.
    """
    html = StreamField(RawHTMLBodyField())

    content_panels = Page.content_panels + [
        StreamFieldPanel('html')
    ] + PublicBasePage.content_panels

    search_fields = PublicBasePage.search_fields + [
        index.SearchField('html', partial_match=True),
    ]

    subpage_types = ['public.StandardPage', 'public.PublicRawHTMLPage'] 
Beispiel #18
0
class HomePage(Page):
    intro = RichTextField(blank=True)

    body = StreamField([
        ('text', blocks.RichTextBlock()),
        ('blockquote', blocks.BlockQuoteBlock()),
        ('image', ImageChooserBlock(template='wagtail_blocks/image.html')),
        ('document', DocumentChooserBlock()),
        ('embed', EmbedBlock(template='wagtail_blocks/embed.html')),
    ], blank=True)

    content_panels = Page.content_panels + [
        FieldPanel('intro'),
        StreamFieldPanel('body'),
    ]
Beispiel #19
0
class KehmetContentPage(RelativeURLMixin, Page):
    body = StreamField(content_blocks)
    tags = ClusterTaggableManager(through=KehmetContentPageTag, blank=True)

    content_panels = [
        FieldPanel('title', classname='full title'),
        FieldPanel('tags'),
        StreamFieldPanel('body'),
    ]
    search_fields = Page.search_fields + [
        index.SearchField('body'),
        tag_search_field,
    ]

    parent_page_types = ['KehmetContentPage', 'KehmetFrontPage']
Beispiel #20
0
class LearnPage(AbstractFilterPage):
    content = StreamField([
        ('image_text_25_75_group', organisms.ImageText2575Group()),
        ('well', organisms.Well()),
        ('full_width_text', organisms.FullWidthText()),
        ('expandable', organisms.Expandable()),
        ('expandable_group', organisms.ExpandableGroup()),
        ('table', organisms.Table(editable=False)),
        ('table_block', TableBlock(table_options={'renderer': 'html'})),
        ('call_to_action', molecules.CallToAction()),
    ],
                          blank=True)
    edit_handler = AbstractFilterPage.generate_edit_handler(
        content_panel=StreamFieldPanel('content'))
    template = 'learn-page/index.html'
Beispiel #21
0
class RobustInfoPage(Page):
    author = models.CharField(max_length=255)
    date = models.DateField("Last updated")
    body = StreamField([
        ('heading', blocks.CharBlock(classname="full title")),
        ('separator', blocks.StaticBlock()),
        ('paragraph', blocks.RichTextBlock()),
        ('image', ImageChooserBlock()),
    ])

    content_panels = Page.content_panels + [
        FieldPanel('author'),
        FieldPanel('date'),
        StreamFieldPanel('body'),
    ]
Beispiel #22
0
class DocumentFeedPage(ContentPage):
    subpage_types = ['DocumentPage']
    intro = StreamField([('paragraph', blocks.RichTextBlock())], null=True)
    category = models.CharField(
        max_length=255,
        choices=constants.report_parent_categories.items(),
        null=True)
    content_panels = Page.content_panels + [
        StreamFieldPanel('intro'),
        FieldPanel('category')
    ]

    @property
    def category_filters(self):
        return constants.report_category_groups[self.category]
Beispiel #23
0
class StreamDashboardTripleColumnPage(BaseStreamDashboardPage):
    class Meta(object):
        verbose_name = _(
            '3-Column Dashboard Page (Modular, DO NOT USE ANYMORE!)')

    content1 = StreamField(STREAMFIELD_OLD_BLOCKS,
                           verbose_name=_('Content (left column)'),
                           blank=True)
    content2 = StreamField(STREAMFIELD_OLD_BLOCKS,
                           verbose_name=_('Content (center column)'),
                           blank=True)
    content3 = StreamField(STREAMFIELD_OLD_BLOCKS,
                           verbose_name=_('Content (right column)'),
                           blank=True)

    # Search index configuraiton
    search_fields = BaseStreamDashboardPage.search_fields + (
        index.SearchField('content1'),
        index.SearchField('content2'),
        index.SearchField('content3'),
    )

    # Editor panels configuration
    content_panels = BaseStreamDashboardPage.content_panels + [
        StreamFieldPanel('content1'),
        StreamFieldPanel('content2'),
        StreamFieldPanel('content3'),
    ]

    template = 'cosinnus/wagtail/dashboard_triple_column_page.html'

    translation_fields = BaseStreamDashboardPage.translation_fields + (
        'content1',
        'content2',
        'content3',
    )
Beispiel #24
0
class TPage(Page):
    author = models.CharField(max_length=255)
    date_created = models.DateField(auto_now_add=True)
    date_modified = models.DateField(auto_now=True)
    body = StreamField([
        ('image', ImageChooserBlock(icon="image")),
        ('image_carousel',
         blocks.ListBlock(ImageCarouselBlock(),
                          template="testapp/t_page.html",
                          icon="image")),
    ])
    content_panels = Page.content_panels + [
        FieldPanel('author'),
        StreamFieldPanel('body'),
    ]
Beispiel #25
0
class DocumentDetailPage(AbstractFilterPage):
    content = StreamField([
        ('full_width_text', organisms.FullWidthText()),
        ('expandable', organisms.Expandable()),
        ('expandable_group', organisms.ExpandableGroup()),
        ('table_block',
         organisms.AtomicTableBlock(table_options={'renderer': 'html'})),
        ('feedback', v1_blocks.Feedback()),
    ],
                          blank=True)
    edit_handler = AbstractFilterPage.generate_edit_handler(
        content_panel=StreamFieldPanel('content'))
    template = 'document-detail/index.html'

    objects = PageManager()
Beispiel #26
0
class HiringPage(Page):
    body = StreamField(PostStreamBlock())
    linked_data = JSONField(null=True, blank=True, help_text=_('Linked Data in JSON'))

    search_fields = Page.search_fields + [
        index.SearchField('body'),
    ]

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]

    promote_panels = Page.promote_panels + [
        FieldPanel('linked_data'),
    ]
Beispiel #27
0
class Footer(models.Model):
    footer_title = models.CharField(max_length=255,
                                    help_text='Add a short description for this footer.')
    # A list of many sub blocks of the same type (FooterItemBlock)
    footer_items = StreamField([
        ('entry', blocks.ListBlock(FooterItemBlock(label='Footer Entry')),),
    ])

    panels = [
        FieldPanel('footer_title'),
        StreamFieldPanel('footer_items')
    ]

    def __str__(self):
        return self.footer_title
Beispiel #28
0
class ContentPage(Page):
    template = 'cms/page.html'

    content = StreamField(BASE_BLOCKS, blank=True)

    class Meta:
        verbose_name = _('Content')

    content_panels = Page.content_panels + [
        StreamFieldPanel('content'),
    ]

    search_fields = Page.search_fields + [
        index.SearchField('content'),
    ]
Beispiel #29
0
class MedicinesPageSection(Orderable):
    page = ParentalKey(MedicinesPage, related_name='sections')
    section = StreamField([
        ('title', MedicinesPageSectionTitle()),
        ('content', MedicinesPageSectionContent()),
        ('callout_alert', MedicinesPageSectionCalloutAlert()),
        ('callout_information', MedicinesPageSectionCalloutInformation()),
        ('callout_emergency', MedicinesPageSectionCalloutEmergency()),
    ],
                          null=True,
                          blank=True)

    panels = [
        StreamFieldPanel('section'),
    ]
Beispiel #30
0
class HomePage(Page):
    heading = models.CharField(max_length=100, default='')
    lead = models.CharField(max_length=150, default='')
    portrait_image = models.ForeignKey('wagtailimages.Image',
                                       null=True,
                                       blank=True,
                                       on_delete=models.SET_NULL,
                                       related_name='+')
    body = StreamField([('heading',
                         blocks.CharBlock(classname='full title',
                                          label='Titel')),
                        ('paragraph', blocks.RichTextBlock(label='Absatz')),
                        ('image', ImageChooserBlock(label='Bild')),
                        ('career',
                         blocks.ListBlock(CareerItemBlock,
                                          label='Karriere',
                                          template='blocks/career.html',
                                          icon='user')),
                        ('skills',
                         blocks.ListBlock(SkillItemBlock,
                                          label='Skills',
                                          template='blocks/skills.html',
                                          icon='pick'))])

    content_panels = Page.content_panels + [
        FieldPanel('heading'),
        FieldPanel('lead'),
        ImageChooserPanel('portrait_image'),
        StreamFieldPanel('body'),
    ]

    subpage_types = ['projects.ProjectIndexPage', 'contact.ContactFormPage']

    def get_context(self, request):
        context = super(HomePage, self).get_context(request)

        context['latest_projects'] = ProjectPage.get_latest()
        return context

    def create_test(title, lead, parent=None):
        if (parent is None):
            parent = Page.get_first_root_node()
        home = HomePage(heading=title,
                        title=title,
                        lead=lead,
                        slug=text.slugify(title))
        parent.add_child(instance=home)
        return home