How to use the wagtail.wagtailcore.blocks function in wagtail

To help you get started, we’ve selected a few wagtail examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nhsuk / nhsuk-content-store / pages / migrations / 0002_auto_20161014_1027.py View on Github external
from django.db import migrations

import images.blocks


class Migration(migrations.Migration):

    dependencies = [
        ('pages', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='simplepage',
            name='before',
            field=wagtail.wagtailcore.fields.StreamField((('markdown', wagtail.wagtailcore.blocks.RichTextBlock(label='markdown')), ('figureList', wagtail.wagtailcore.blocks.ListBlock(images.blocks.ImageChooserBlock(), label='figure list'))), blank=True, null=True),
        ),
        migrations.AlterField(
            model_name='simplepage',
            name='main',
            field=wagtail.wagtailcore.fields.StreamField((('markdown', wagtail.wagtailcore.blocks.RichTextBlock(label='markdown')), ('calloutInfo', wagtail.wagtailcore.blocks.RichTextBlock(label='callout info')), ('calloutWarning', wagtail.wagtailcore.blocks.RichTextBlock(label='callout warning'))), blank=True, null=True),
        ),
github nhsuk / nhsuk-content-store / pages / migrations / 0005_auto_20161118_1530.py View on Github external
fields=[
            ],
            options={
                'proxy': True,
            },
            bases=('wagtailcore.page',),
        ),
        migrations.AlterField(
            model_name='editorialpage',
            name='local_header',
            field=wagtail.wagtailcore.fields.StreamField((('markdown', wagtail.wagtailcore.blocks.RichTextBlock(label='markdown')), ('sectionNav', pages.blocks.StaticBlock(admin_text='Section Navigation', label='section nav'))), blank=True, null=True),
        ),
        migrations.AlterField(
            model_name='editorialpage',
            name='main',
            field=wagtail.wagtailcore.fields.StreamField((('markdown', wagtail.wagtailcore.blocks.RichTextBlock(label='markdown')), ('calloutInfo', wagtail.wagtailcore.blocks.RichTextBlock(label='callout info')), ('calloutWarning', wagtail.wagtailcore.blocks.RichTextBlock(label='callout warning')), ('sectionList', wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock()), ('sections', pages.blocks.ListBlock(wagtail.wagtailcore.blocks.StructBlock((('title', wagtail.wagtailcore.blocks.CharBlock()), ('content', wagtail.wagtailcore.blocks.StreamBlock((('image', images.blocks.ImageChooserBlock(label='image')), ('markdown', wagtail.wagtailcore.blocks.RichTextBlock(label='markdown')))))))))), label='section list'))), blank=True, null=True),
        ),
github codeforamerica / syracuse_biz_portal / biz_content / migrations / 0050_auto_20170123_2323.py View on Github external
class Migration(migrations.Migration):

    dependencies = [
        ('biz_content', '0049_auto_20170123_2225'),
    ]

    operations = [
        migrations.AlterField(
            model_name='collectionpage',
            name='page_content',
            field=wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title', icon='title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('email', wagtail.wagtailcore.blocks.EmailBlock(classname='email', help_text='Add an email', label='Email', template='biz_content/content_blocks/email_block.html')), ('phone_number', wagtail.wagtailcore.blocks.StructBlock((('phone_number', biz_content.models.CustomCleanRegexBlock(classname='phone_number', custom_clean=biz_content.models.clean_phone_number, error_messages={'invalid': 'Add a ten digit phone number not starting with 1'}, help_text='Add a 10 digit phone number, including area code', label='Phone Number (10 digits)', regex='^\\D*[2-9]\\D*(\\d\\D*){9}$')), ('ext', wagtail.wagtailcore.blocks.IntegerBlock(classname='ext', help_text='Add optional extension', label='Extension', min_value=1, required=False))), classname='phone_number', label='Phone Number')), ('link', wagtail.wagtailcore.blocks.StructBlock((('link_text', wagtail.wagtailcore.blocks.CharBlock()), ('link_url', wagtail.wagtailcore.blocks.URLBlock())), classname='text', help_text='Add resource link', icon='fa-link', label='Link', template='biz_content/content_blocks/url_block.html')), ('alert_text', wagtail.wagtailcore.blocks.CharBlock(classname='alert_text', help_text='Add Alert Text', icon='fa-exclamation', label='Alert Text', max_length=2000, template='biz_content/content_blocks/alert_text.html')), ('embed_block', wagtail.wagtailcore.blocks.RawHTMLBlock(help_text='Copy and paste a map or video embed directly here.', icon='fa-code'))), blank=True, null=True),
        ),
        migrations.AlterField(
            model_name='steppage',
            name='page_content',
            field=wagtail.wagtailcore.fields.StreamField((('heading', wagtail.wagtailcore.blocks.CharBlock(classname='full title', icon='title')), ('paragraph', wagtail.wagtailcore.blocks.RichTextBlock()), ('email', wagtail.wagtailcore.blocks.EmailBlock(classname='email', help_text='Add an email', label='Email', template='biz_content/content_blocks/email_block.html')), ('phone_number', wagtail.wagtailcore.blocks.StructBlock((('phone_number', biz_content.models.CustomCleanRegexBlock(classname='phone_number', custom_clean=biz_content.models.clean_phone_number, error_messages={'invalid': 'Add a ten digit phone number not starting with 1'}, help_text='Add a 10 digit phone number, including area code', label='Phone Number (10 digits)', regex='^\\D*[2-9]\\D*(\\d\\D*){9}$')), ('ext', wagtail.wagtailcore.blocks.IntegerBlock(classname='ext', help_text='Add optional extension', label='Extension', min_value=1, required=False))), classname='phone_number', label='Phone Number')), ('link', wagtail.wagtailcore.blocks.StructBlock((('link_text', wagtail.wagtailcore.blocks.CharBlock()), ('link_url', wagtail.wagtailcore.blocks.URLBlock())), classname='text', help_text='Add resource link', icon='fa-link', label='Link', template='biz_content/content_blocks/url_block.html')), ('alert_text', wagtail.wagtailcore.blocks.CharBlock(classname='alert_text', help_text='Add Alert Text', icon='fa-exclamation', label='Alert Text', max_length=2000, template='biz_content/content_blocks/alert_text.html')), ('embed_block', wagtail.wagtailcore.blocks.RawHTMLBlock(help_text='Copy and paste a map or video embed directly here.', icon='fa-code'))), blank=True, null=True),
        ),
github liqd / a4-opin / home / models.py View on Github external
class Meta:
        template = 'home/blocks/page_collection_block.html'
        icon = 'snippet'
        label = 'Page Collection'


class InlineImageBlock(core_blocks.StructBlock):
    image = image_blocks.ImageChooserBlock()
    internal_link = core_blocks.PageChooserBlock(required=False)
    external_link = core_blocks.URLBlock(required=False)
    link_text = core_blocks.TextBlock(required=False)


class InlineImagesBlock(core_blocks.StructBlock):

    inline_images = core_blocks.ListBlock(InlineImageBlock())
    columns = core_blocks.ChoiceBlock(choices=[
        ('4', 'three columns'),
        ('6', 'two columns'),
    ], icon='cup', required=False, help_text='')

    class Meta:
        template = 'home/blocks/inline_images_block.html'
        icon = 'placeholder'
        label = 'Inline Images Block'


class CallToActionBlock(core_blocks.StructBlock):
    internal_link = core_blocks.PageChooserBlock(required=False)
    external_link = core_blocks.URLBlock(required=False)
    link_text = core_blocks.TextBlock(required=False)
github torchbox / wagtail-torchbox / tbx / core / migrations / 0077_auto_20161129_1011.py View on Github external
from django.db import migrations
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields


class Migration(migrations.Migration):

    dependencies = [
        ('torchbox', '0076_merge'),
    ]

    operations = [
        migrations.AlterField(
            model_name='servicepage',
            name='streamfield',
            field=wagtail.wagtailcore.fields.StreamField([(b'case_studies', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'intro', wagtail.wagtailcore.blocks.TextBlock(required=True)), (b'case_studies', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.PageChooserBlock(['torchbox.WorkPage'])))])), (b'highlights', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'intro', wagtail.wagtailcore.blocks.TextBlock()), (b'highlights', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.TextBlock()))])), (b'pull_quote', wagtail.wagtailcore.blocks.StructBlock([(b'quote', wagtail.wagtailcore.blocks.CharBlock(classname='quote title')), (b'attribution', wagtail.wagtailcore.blocks.CharBlock())], template='blocks/pull_quote_block.html')), (b'process', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'intro', wagtail.wagtailcore.blocks.TextBlock()), (b'steps', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.StructBlock([('title', wagtail.wagtailcore.blocks.CharBlock(required=True)), ('icon', wagtail.wagtailcore.blocks.CharBlock(help_text='Paste SVG code here', max_length=9000, required=True)), ('description', wagtail.wagtailcore.blocks.TextBlock(required=True))])))])), (b'people', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'intro', wagtail.wagtailcore.blocks.TextBlock(required=True)), (b'people', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.PageChooserBlock()))]))]),
        ),
github TakwimuAfrica / Takwimu / takwimu / migrations / 0017_explainersteps.py View on Github external
class Migration(migrations.Migration):

    dependencies = [
        ('wagtailcore', '0040_page_draft_title'),
        ('takwimu', '0016_auto_20180707_1812'),
    ]

    operations = [
        migrations.CreateModel(
            name='ExplainerSteps',
            fields=[
                ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
                ('sidebar', wagtail.wagtailcore.fields.RichTextField()),
                ('steps', wagtail.wagtailcore.fields.StreamField([(b'step', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'brief', wagtail.wagtailcore.blocks.TextBlock(required=False)), (b'color', wagtail.wagtailcore.blocks.CharBlock(help_text=b'Background colour.', required=False)), (b'body', wagtail.wagtailcore.blocks.RichTextBlock(required=False))], icon=b'user'))])),
            ],
            options={
                'abstract': False,
            },
            bases=('wagtailcore.page',),
        ),
github nhsuk / nhsuk-content-store / pages / migrations / 0010_auto_20161221_1701.py View on Github external
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('pages', '0009_auto_20161221_1642'),
    ]

    operations = [
        migrations.AlterField(
            model_name='editorialpage',
            name='main',
            field=wagtail.wagtailcore.fields.StreamField((('markdown', wagtail.wagtailcore.blocks.RichTextBlock(icon='radio-full', label='markdown')), ('panel', wagtail.wagtailcore.blocks.StructBlock((('main', wagtail.wagtailcore.blocks.RichTextBlock(label='Panel content')), ('footer', wagtail.wagtailcore.blocks.RichTextBlock(label='Footer content', required=False))), icon='radio-full', label='panel')), ('splitPanel', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.RichTextBlock(label='Area'), icon='radio-full', label='split panel'))), blank=True, null=True, verbose_name='Main Content'),
        ),
github wagtail / bakerydemo / bakerydemo / base / migrations / 0004_homepage.py View on Github external
class Migration(migrations.Migration):

    dependencies = [
        ('wagtailcore', '0032_add_bulk_delete_page_permission'),
        ('wagtailimages', '0018_remove_rendition_filter'),
        ('base', '0003_auto_20170209_1651'),
    ]

    operations = [
        migrations.CreateModel(
            name='HomePage',
            fields=[
                ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.Page')),
                ('body', wagtail.wagtailcore.fields.StreamField((('heading_block', wagtail.wagtailcore.blocks.StructBlock((('heading_text', wagtail.wagtailcore.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.wagtailcore.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.wagtailcore.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.wagtailcore.blocks.StructBlock((('image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.wagtailcore.blocks.CharBlock(required=False)), ('attribution', wagtail.wagtailcore.blocks.CharBlock(required=False))))), ('block_quote', wagtail.wagtailcore.blocks.StructBlock((('attribute_name', wagtail.wagtailcore.blocks.CharBlock(blank=True, label='e.g. Guy Picciotto', required=False)),))), ('embed_block', wagtail.wagtailembeds.blocks.EmbedBlock(help_text='Insert an embed URL e.g https://www.youtube.com/embed/SGJFWirQ3ks', icon='fa-s15', template='blocks/embed_block.html'))), blank=True, verbose_name='Home page detail')),
                ('image', models.ForeignKey(blank=True, help_text='Location image', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.Image')),
            ],
            options={
                'abstract': False,
            },
            bases=('wagtailcore.page',),
        ),
github TakwimuAfrica / Takwimu / takwimu / migrations / 0025_auto_20180720_0724.py View on Github external
import wagtail.wagtaildocs.blocks
import wagtail.wagtailembeds.blocks
import wagtail.wagtailimages.blocks


class Migration(migrations.Migration):

    dependencies = [
        ('takwimu', '0024_auto_20180717_1622'),
    ]

    operations = [
        migrations.AlterField(
            model_name='profilepage',
            name='body',
            field=wagtail.wagtailcore.fields.StreamField([(b'topic', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'icon', takwimu.models.dashboard.IconChoiceBlock(required=False)), (b'summary', wagtail.wagtailcore.blocks.TextBlock(required=False)), (b'body', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), (b'indicators', wagtail.wagtailcore.blocks.StreamBlock([(b'free_form', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'body', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'snippet', template=b'takwimu/_includes/dataview/freeform.html')), (b'data_indicator', takwimu.models.dashboard.DataIndicatorChooserBlock()), (b'embed', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'embed', wagtail.wagtailembeds.blocks.EmbedBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'media', template=b'takwimu/_includes/dataview/embed.html')), (b'document', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'document', wagtail.wagtaildocs.blocks.DocumentChooserBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'doc-full', template=b'takwimu/_includes/dataview/document.html')), (b'image', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=False)), (b'caption', wagtail.wagtailcore.blocks.TextBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'image', template=b'takwimu/_includes/dataview/image.html')), (b'html', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'code', template=b'takwimu/_includes/dataview/code.html')), (b'entities', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'entities', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.StructBlock([(b'name', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=False)), (b'description', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))]))), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'group', template=b'takwimu/_includes/dataview/entities.html'))], required=False))]))], blank=True),
        ),
        migrations.AlterField(
            model_name='profilesectionpage',
            name='body',
            field=wagtail.wagtailcore.fields.StreamField([(b'topic', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'icon', takwimu.models.dashboard.IconChoiceBlock(required=False)), (b'summary', wagtail.wagtailcore.blocks.TextBlock(required=False)), (b'body', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), (b'indicators', wagtail.wagtailcore.blocks.StreamBlock([(b'free_form', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'body', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'snippet', template=b'takwimu/_includes/dataview/freeform.html')), (b'data_indicator', takwimu.models.dashboard.DataIndicatorChooserBlock()), (b'embed', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'embed', wagtail.wagtailembeds.blocks.EmbedBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'media', template=b'takwimu/_includes/dataview/embed.html')), (b'document', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'document', wagtail.wagtaildocs.blocks.DocumentChooserBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'doc-full', template=b'takwimu/_includes/dataview/document.html')), (b'image', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=False)), (b'caption', wagtail.wagtailcore.blocks.TextBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'image', template=b'takwimu/_includes/dataview/image.html')), (b'html', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'raw_html', wagtail.wagtailcore.blocks.RawHTMLBlock(required=False)), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'code', template=b'takwimu/_includes/dataview/code.html')), (b'entities', wagtail.wagtailcore.blocks.StructBlock([(b'title', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'hide_title', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False)), (b'entities', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.StructBlock([(b'name', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'image', wagtail.wagtailimages.blocks.ImageChooserBlock(required=False)), (b'description', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))]))), (b'source', wagtail.wagtailcore.blocks.RichTextBlock(features=[b'link'], required=False))], icon=b'group', template=b'takwimu/_includes/dataview/entities.html'))], required=False))]))], blank=True),
        ),
github invinst / CPDB / home / models.py View on Github external
from __future__ import unicode_literals
import json

from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailadmin.edit_handlers import StreamFieldPanel
from wagtail.wagtailcore import blocks
from wagtail.wagtailcore.rich_text import expand_db_html


class HomePage(Page):
    body = StreamField([
        ('row_section', blocks.StreamBlock([
            ('half_paragraph', blocks.RichTextBlock()),
            ('full_paragraph', blocks.RichTextBlock()),
        ])),
        ('table_section', blocks.StreamBlock([
            ('glossary_table_row', blocks.StructBlock([
                ('term', blocks.CharBlock()),
                ('definition', blocks.TextBlock()),
                ('category', blocks.ChoiceBlock(choices=[
                    ('n_a', 'n/a'),
                    ('outcomes', 'Outcomes'),
                    ('organizational', 'Organizational'),
                    ('complaint-process', 'Complaint Process')
                    ]))
                ])),
            ('table_row', blocks.StreamBlock([
                ('table_text_cell', blocks.TextBlock()),