How to use the wagtail.core.blocks.CharBlock 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 mozilla / foundation.mozilla.org / network-api / networkapi / wagtailpages / pagemodels / customblocks / latest_profile_list.py View on Github external
required=True,
        help_text='Pick up to 48 profiles.',
    )

    advanced_filter_header = blocks.StaticBlock(
        label=' ',
        admin_text='-------- ADVANCED FILTERS: OPTIONS TO DISPLAY FEWER, MORE TARGETED RESULTS. --------',
    )

    profile_type = blocks.CharBlock(
        required=False,
        default='',
        help_text='Example: Fellow.'
    )

    program_type = blocks.CharBlock(
        required=False,
        default='',
        help_text='Example: Tech Policy.'
    )

    year = blocks.CharBlock(
        required=False,
        default=''
    )

    def get_context(self, value, parent_context=None, no_limit=False, initial_year=False, ordering=False):
        context = super().get_context(value, parent_context=parent_context)

        query_args = {
            'limit': value['max_number_of_results'],
            'profile_type': value['profile_type'],
github mozilla / foundation.mozilla.org / network-api / networkapi / wagtailpages / pagemodels / customblocks / annotated_image_block.py View on Github external
from wagtail.core import blocks
from .image_block import ImageBlock


class AnnotatedImageBlock(ImageBlock):
    caption = blocks.CharBlock(
        required=False
    )
    captionURL = blocks.CharBlock(
        required=False,
        help_text='Optional URL that this caption should link out to.'
    )

    class Meta:
        icon = 'image'
        template = 'wagtailpages/blocks/annotated_image_block.html'
        help_text = 'Design Guideline: Please crop images to a 16:6 aspect ratio when possible.'
github raq929 / wagtail-project-template / simple / migrations / 0002_auto_20170809_2141.py View on Github external
import wagtail.core.fields
import wagtail.embeds.blocks
import wagtail.images.blocks


class Migration(migrations.Migration):

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

    operations = [
        migrations.AlterField(
            model_name='simplepage',
            name='body',
            field=wagtail.core.fields.StreamField((('text', wagtail.core.blocks.StructBlock((('text', wagtail.core.blocks.RichTextBlock()), ('background_color', wagtail.core.blocks.ChoiceBlock(choices=[('white', 'White'), ('eastern-blue', 'Eastern Blue'), ('gamboge', 'Gamboge'), ('green', 'Green'), ('pink', 'Pink'), ('red', 'Red'), ('royal-blue', 'Royal Blue'), ('teal', 'Teal'), ('violet', 'Violet'), ('dark-gray', 'Dark Gray')])), ('text_align', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Left'), ('center', 'Center'), ('right', 'Right')])), ('font_size', wagtail.core.blocks.ChoiceBlock(choices=[('small', 'Small'), ('normal', 'Normal'), ('large', 'Large'), ('jumbo', 'Jumbo')])), ('font_family', wagtail.core.blocks.ChoiceBlock(choices=[('sans-serif', 'Sans Serif'), ('serif', 'Serif')]))), label='Text', template='common/blocks/styled_text_full_bleed.html')), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right'), ('full-width', 'Full Width')]))))), ('raw_html', wagtail.core.blocks.RawHTMLBlock()), ('blockquote', wagtail.core.blocks.StructBlock((('text', wagtail.core.blocks.RichTextBlock()), ('source_text', wagtail.core.blocks.RichTextBlock(required=False)), ('source_url', wagtail.core.blocks.URLBlock(help_text='Source text will link to this url.', required=False))))), ('list', wagtail.core.blocks.ListBlock(wagtail.core.blocks.CharBlock(label='List Item'), template='common/blocks/list_block_columns.html')), ('video', wagtail.core.blocks.StructBlock((('video', wagtail.embeds.blocks.EmbedBlock()), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right'), ('full-width', 'Full Width')]))))), ('heading_1', wagtail.core.blocks.StructBlock((('content', wagtail.core.blocks.CharBlock()),))), ('heading_2', wagtail.core.blocks.StructBlock((('content', wagtail.core.blocks.CharBlock()),))), ('heading_3', wagtail.core.blocks.StructBlock((('content', wagtail.core.blocks.CharBlock()),))))),
        ),
        migrations.AlterField(
            model_name='simplepagewithmenusidebar',
            name='body',
            field=wagtail.core.fields.StreamField((('text', wagtail.core.blocks.StructBlock((('text', wagtail.core.blocks.RichTextBlock()), ('background_color', wagtail.core.blocks.ChoiceBlock(choices=[('white', 'White'), ('eastern-blue', 'Eastern Blue'), ('gamboge', 'Gamboge'), ('green', 'Green'), ('pink', 'Pink'), ('red', 'Red'), ('royal-blue', 'Royal Blue'), ('teal', 'Teal'), ('violet', 'Violet'), ('dark-gray', 'Dark Gray')])), ('text_align', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Left'), ('center', 'Center'), ('right', 'Right')])), ('font_size', wagtail.core.blocks.ChoiceBlock(choices=[('small', 'Small'), ('normal', 'Normal'), ('large', 'Large'), ('jumbo', 'Jumbo')])), ('font_family', wagtail.core.blocks.ChoiceBlock(choices=[('sans-serif', 'Sans Serif'), ('serif', 'Serif')]))), label='Text')), ('image', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock()), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right'), ('full-width', 'Full Width')]))))), ('raw_html', wagtail.core.blocks.RawHTMLBlock()), ('blockquote', wagtail.core.blocks.StructBlock((('text', wagtail.core.blocks.RichTextBlock()), ('source_text', wagtail.core.blocks.RichTextBlock(required=False)), ('source_url', wagtail.core.blocks.URLBlock(help_text='Source text will link to this url.', required=False))))), ('list', wagtail.core.blocks.ListBlock(wagtail.core.blocks.CharBlock(label='List Item'), template='common/blocks/list_block_columns.html')), ('video', wagtail.core.blocks.StructBlock((('video', wagtail.embeds.blocks.EmbedBlock()), ('alignment', wagtail.core.blocks.ChoiceBlock(choices=[('left', 'Left'), ('right', 'Right'), ('full-width', 'Full Width')]))))), ('heading_1', wagtail.core.blocks.StructBlock((('content', wagtail.core.blocks.CharBlock()),))), ('heading_2', wagtail.core.blocks.StructBlock((('content', wagtail.core.blocks.CharBlock()),))), ('heading_3', wagtail.core.blocks.StructBlock((('content', wagtail.core.blocks.CharBlock()),))))),
        ),
github wagtail / wagtail-localize / wagtail_localize / segments / ingest.py View on Github external
def handle_block(self, block_type, block_value, segments):
        if hasattr(block_type, "restore_translated_segments"):
            return block_type.restore_translated_segments(block_value, segments)

        elif isinstance(block_type, (blocks.CharBlock, blocks.TextBlock)):
            return segments[0].render_text()

        elif isinstance(block_type, blocks.RichTextBlock):
            format, template, strings = organise_template_segments(segments)
            assert format == "html"
            return RichText(restore_strings(template, strings))

        elif isinstance(block_type, blocks.ChooserBlock):
            return self.handle_related_object_block(block_value, segments)

        elif isinstance(block_type, blocks.StructBlock):
            return self.handle_struct_block(block_value, segments)

        elif isinstance(block_type, blocks.ListBlock):
            return self.handle_list_block(block_value, segments)
github mdn / developer-portal / developerportal / apps / topics / migrations / 0012_auto_20190614_1319.py View on Github external
class Migration(migrations.Migration):

    dependencies = [("topics", "0011_auto_20190614_0932")]

    operations = [
        migrations.AlterField(
            model_name="topic",
            name="get_started",
            field=wagtail.core.fields.StreamField(
                [
                    (
                        "panel",
                        wagtail.core.blocks.StructBlock(
                            [
                                ("title", wagtail.core.blocks.CharBlock()),
                                ("image", wagtail.images.blocks.ImageChooserBlock()),
                                ("description", wagtail.core.blocks.TextBlock()),
                                ("button_text", wagtail.core.blocks.CharBlock()),
                                (
                                    "button_destination",
                                    wagtail.core.blocks.PageChooserBlock(),
                                ),
github cartologic / cartoview / cartoview / cms / migrations / 0001_initial.py View on Github external
('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')),
                ('heading', models.CharField(default='Apps', max_length=255)),
                ('abstract', models.TextField(blank=True, null=True)),
                ('apps', wagtail.core.fields.StreamField([('apps', cartoview.cms.db_models.app_manager.apps_list.AppChooserblock(required=True))], blank=True)),
            ],
            options={
                'abstract': False,
            },
            bases=('wagtailcore.page',),
        ),
        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')),
                ('hero', wagtail.core.fields.StreamField([('hero_area', wagtail.core.blocks.StructBlock([('main_text', wagtail.core.blocks.CharBlock(label='Main Text', max_length=120, required=False)), ('body_text', wagtail.core.blocks.RichTextBlock(label='Body Text', required=False)), ('background_image', wagtail.images.blocks.ImageChooserBlock(label='Background Image')), ('links', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('theme', wagtail.core.blocks.ChoiceBlock(choices=[('primary', 'Primary'), ('info', 'Info'), ('success', 'Success'), ('danger', 'Danger'), ('warning', 'Warning'), ('default', 'Default')], label='Theme')), ('icon', wagtail.core.blocks.ChoiceBlock(choices=[('address-book', 'address-book'), ('address-book-o', 'address-book-o'), ('address-card', 'address-card'), ('address-card-o', 'address-card-o'), ('adjust', 'adjust'), ('american-sign-language-interpreting', 'american-sign-language-interpreting'), ('anchor', 'anchor'), ('archive', 'archive'), ('area-chart', 'area-chart'), ('arrows', 'arrows'), ('arrows-h', 'arrows-h'), ('arrows-v', 'arrows-v'), ('asl-interpreting ', 'asl-interpreting '), ('assistive-listening-systems', 'assistive-listening-systems'), ('asterisk', 'asterisk'), ('at', 'at'), ('audio-description', 'audio-description'), ('automobile ', 'automobile '), ('balance-scale', 'balance-scale'), ('ban', 'ban'), ('bank ', 'bank '), ('bar-chart', 'bar-chart'), ('bar-chart-o ', 'bar-chart-o '), ('barcode', 'barcode'), ('bars', 'bars'), ('bath', 'bath'), ('bathtub ', 'bathtub '), ('battery ', 'battery '), ('battery-0 ', 'battery-0 '), ('battery-1 ', 'battery-1 '), ('battery-2 ', 'battery-2 '), ('battery-3 ', 'battery-3 '), ('battery-4 ', 'battery-4 '), ('battery-empty', 'battery-empty'), ('battery-full', 'battery-full'), ('battery-half', 'battery-half'), ('battery-quarter', 'battery-quarter'), ('battery-three-quarters', 'battery-three-quarters'), ('bed', 'bed'), ('beer', 'beer'), ('bell', 'bell'), ('bell-o', 'bell-o'), ('bell-slash', 'bell-slash'), ('bell-slash-o', 'bell-slash-o'), ('bicycle', 'bicycle'), ('binoculars', 'binoculars'), ('birthday-cake', 'birthday-cake'), ('blind', 'blind'), ('bluetooth', 'bluetooth'), ('bluetooth-b', 'bluetooth-b'), ('bolt', 'bolt'), ('bomb', 'bomb'), ('book', 'book'), ('bookmark', 'bookmark'), ('bookmark-o', 'bookmark-o'), ('braille', 'braille'), ('briefcase', 'briefcase'), ('bug', 'bug'), ('building', 'building'), ('building-o', 'building-o'), ('bullhorn', 'bullhorn'), ('bullseye', 'bullseye'), ('bus', 'bus'), ('cab ', 'cab '), ('calculator', 'calculator'), ('calendar', 'calendar'), ('calendar-check-o', 'calendar-check-o'), ('calendar-minus-o', 'calendar-minus-o'), ('calendar-o', 'calendar-o'), ('calendar-plus-o', 'calendar-plus-o'), ('calendar-times-o', 'calendar-times-o'), ('camera', 'camera'), ('camera-retro', 'camera-retro'), ('car', 'car'), ('caret-square-o-down', 'caret-square-o-down'), ('caret-square-o-left', 'caret-square-o-left'), ('caret-square-o-right', 'caret-square-o-right'), ('caret-square-o-up', 'caret-square-o-up'), ('cart-arrow-down', 'cart-arrow-down'), ('cart-plus', 'cart-plus'), ('cc', 'cc'), ('certificate', 'certificate'), ('check', 'check'), ('check-circle', 'check-circle'), ('check-circle-o', 'check-circle-o'), ('check-square', 'check-square'), ('check-square-o', 'check-square-o'), ('child', 'child'), ('circle', 'circle'), ('circle-o', 'circle-o'), ('circle-o-notch', 'circle-o-notch'), ('circle-thin', 'circle-thin'), ('clock-o', 'clock-o'), ('clone', 'clone'), ('close ', 'close '), ('cloud', 'cloud'), ('cloud-download', 'cloud-download'), ('cloud-upload', 'cloud-upload'), ('code', 'code'), ('code-fork', 'code-fork'), ('coffee', 'coffee'), ('cog', 'cog'), ('cogs', 'cogs'), ('comment', 'comment'), ('comment-o', 'comment-o'), ('commenting', 'commenting'), ('commenting-o', 'commenting-o'), ('comments', 'comments'), ('comments-o', 'comments-o'), ('compass', 'compass'), ('copyright', 'copyright'), ('creative-commons', 'creative-commons'), ('credit-card', 'credit-card'), ('credit-card-alt', 'credit-card-alt'), ('crop', 'crop'), ('crosshairs', 'crosshairs'), ('cube', 'cube'), ('cubes', 'cubes'), ('cutlery', 'cutlery'), ('dashboard ', 'dashboard '), ('database', 'database'), ('deaf', 'deaf'), ('deafness ', 'deafness '), ('desktop', 'desktop'), ('diamond', 'diamond'), ('dot-circle-o', 'dot-circle-o'), ('download', 'download'), ('drivers-license ', 'drivers-license '), ('drivers-license-o ', 'drivers-license-o '), ('edit ', 'edit '), ('ellipsis-h', 'ellipsis-h'), ('ellipsis-v', 'ellipsis-v'), ('envelope', 'envelope'), ('envelope-o', 'envelope-o'), ('envelope-open', 'envelope-open'), ('envelope-open-o', 'envelope-open-o'), ('envelope-square', 'envelope-square'), ('eraser', 'eraser'), ('exchange', 'exchange'), ('exclamation', 'exclamation'), ('exclamation-circle', 'exclamation-circle'), ('exclamation-triangle', 'exclamation-triangle'), ('external-link', 'external-link'), ('external-link-square', 'external-link-square'), ('eye', 'eye'), ('eye-slash', 'eye-slash'), ('eyedropper', 'eyedropper'), ('fax', 'fax'), ('feed ', 'feed '), ('female', 'female'), ('fighter-jet', 'fighter-jet'), ('file-archive-o', 'file-archive-o'), ('file-audio-o', 'file-audio-o'), ('file-code-o', 'file-code-o'), ('file-excel-o', 'file-excel-o'), ('file-image-o', 'file-image-o'), ('file-movie-o ', 'file-movie-o '), ('file-pdf-o', 'file-pdf-o'), ('file-photo-o ', 'file-photo-o '), ('file-picture-o ', 'file-picture-o '), ('file-powerpoint-o', 'file-powerpoint-o'), ('file-sound-o ', 'file-sound-o '), ('file-video-o', 'file-video-o'), ('file-word-o', 'file-word-o'), ('file-zip-o ', 'file-zip-o '), ('film', 'film'), ('filter', 'filter'), ('fire', 'fire'), ('fire-extinguisher', 'fire-extinguisher'), ('flag', 'flag'), ('flag-checkered', 'flag-checkered'), ('flag-o', 'flag-o'), ('flash ', 'flash '), ('flask', 'flask'), ('folder', 'folder'), ('folder-o', 'folder-o'), ('folder-open', 'folder-open'), ('folder-open-o', 'folder-open-o'), ('frown-o', 'frown-o'), ('futbol-o', 'futbol-o'), ('gamepad', 'gamepad'), ('gavel', 'gavel'), ('gear ', 'gear '), ('gears ', 'gears '), ('gift', 'gift'), ('glass', 'glass'), ('globe', 'globe'), ('graduation-cap', 'graduation-cap'), ('group ', 'group '), ('hand-grab-o ', 'hand-grab-o '), ('hand-lizard-o', 'hand-lizard-o'), ('hand-paper-o', 'hand-paper-o'), ('hand-peace-o', 'hand-peace-o'), ('hand-pointer-o', 'hand-pointer-o'), ('hand-rock-o', 'hand-rock-o'), ('hand-scissors-o', 'hand-scissors-o'), ('hand-spock-o', 'hand-spock-o'), ('hand-stop-o ', 'hand-stop-o '), ('handshake-o', 'handshake-o'), ('hard-of-hearing ', 'hard-of-hearing '), ('hashtag', 'hashtag'), ('hdd-o', 'hdd-o'), ('headphones', 'headphones'), ('heart', 'heart'), ('heart-o', 'heart-o'), ('heartbeat', 'heartbeat'), ('history', 'history'), ('home', 'home'), ('hotel ', 'hotel '), ('hourglass', 'hourglass'), ('hourglass-1 ', 'hourglass-1 '), ('hourglass-2 ', 'hourglass-2 '), ('hourglass-3 ', 'hourglass-3 '), ('hourglass-end', 'hourglass-end'), ('hourglass-half', 'hourglass-half'), ('hourglass-o', 'hourglass-o'), ('hourglass-start', 'hourglass-start'), ('i-cursor', 'i-cursor'), ('id-badge', 'id-badge'), ('id-card', 'id-card'), ('id-card-o', 'id-card-o'), ('image ', 'image '), ('inbox', 'inbox'), ('industry', 'industry'), ('info', 'info'), ('info-circle', 'info-circle'), ('institution ', 'institution '), ('key', 'key'), ('keyboard-o', 'keyboard-o'), ('language', 'language'), ('laptop', 'laptop'), ('leaf', 'leaf'), ('legal ', 'legal '), ('lemon-o', 'lemon-o'), ('level-down', 'level-down'), ('level-up', 'level-up'), ('life-bouy ', 'life-bouy '), ('life-buoy ', 'life-buoy '), ('life-ring', 'life-ring'), ('life-saver ', 'life-saver '), ('lightbulb-o', 'lightbulb-o'), ('line-chart', 'line-chart'), ('location-arrow', 'location-arrow'), ('lock', 'lock'), ('low-vision', 'low-vision'), ('magic', 'magic'), ('magnet', 'magnet'), ('mail-forward ', 'mail-forward '), ('mail-reply ', 'mail-reply '), ('mail-reply-all ', 'mail-reply-all '), ('male', 'male'), ('map', 'map'), ('map-marker', 'map-marker'), ('map-o', 'map-o'), ('map-pin', 'map-pin'), ('map-signs', 'map-signs'), ('meh-o', 'meh-o'), ('microchip', 'microchip'), ('microphone', 'microphone'), ('microphone-slash', 'microphone-slash'), ('minus', 'minus'), ('minus-circle', 'minus-circle'), ('minus-square', 'minus-square'), ('minus-square-o', 'minus-square-o'), ('mobile', 'mobile'), ('mobile-phone ', 'mobile-phone '), ('money', 'money'), ('moon-o', 'moon-o'), ('mortar-board ', 'mortar-board '), ('motorcycle', 'motorcycle'), ('mouse-pointer', 'mouse-pointer'), ('music', 'music'), ('navicon ', 'navicon '), ('newspaper-o', 'newspaper-o'), ('object-group', 'object-group'), ('object-ungroup', 'object-ungroup'), ('paint-brush', 'paint-brush'), ('paper-plane', 'paper-plane'), ('paper-plane-o', 'paper-plane-o'), ('paw', 'paw'), ('pencil', 'pencil'), ('pencil-square', 'pencil-square'), ('pencil-square-o', 'pencil-square-o'), ('percent', 'percent'), ('phone', 'phone'), ('phone-square', 'phone-square'), ('photo ', 'photo '), ('picture-o', 'picture-o'), ('pie-chart', 'pie-chart'), ('plane', 'plane'), ('plug', 'plug'), ('plus', 'plus'), ('plus-circle', 'plus-circle'), ('plus-square', 'plus-square'), ('plus-square-o', 'plus-square-o'), ('podcast', 'podcast'), ('power-off', 'power-off'), ('print', 'print'), ('puzzle-piece', 'puzzle-piece'), ('qrcode', 'qrcode'), ('question', 'question'), ('question-circle', 'question-circle'), ('question-circle-o', 'question-circle-o'), ('quote-left', 'quote-left'), ('quote-right', 'quote-right'), ('random', 'random'), ('recycle', 'recycle'), ('refresh', 'refresh'), ('registered', 'registered'), ('remove ', 'remove '), ('reorder ', 'reorder '), ('reply', 'reply'), ('reply-all', 'reply-all'), ('retweet', 'retweet'), ('road', 'road'), ('rocket', 'rocket'), ('rss', 'rss'), ('rss-square', 'rss-square'), ('s15 ', 's15 '), ('search', 'search'), ('search-minus', 'search-minus'), ('search-plus', 'search-plus'), ('send ', 'send '), ('send-o ', 'send-o '), ('server', 'server'), ('share', 'share'), ('share-alt', 'share-alt'), ('share-alt-square', 'share-alt-square'), ('share-square', 'share-square'), ('share-square-o', 'share-square-o'), ('shield', 'shield'), ('ship', 'ship'), ('shopping-bag', 'shopping-bag'), ('shopping-basket', 'shopping-basket'), ('shopping-cart', 'shopping-cart'), ('shower', 'shower'), ('sign-in', 'sign-in'), ('sign-language', 'sign-language'), ('sign-out', 'sign-out'), ('signal', 'signal'), ('signing ', 'signing '), ('sitemap', 'sitemap'), ('sliders', 'sliders'), ('smile-o', 'smile-o'), ('snowflake-o', 'snowflake-o'), ('soccer-ball-o ', 'soccer-ball-o '), ('sort', 'sort'), ('sort-alpha-asc', 'sort-alpha-asc'), ('sort-alpha-desc', 'sort-alpha-desc'), ('sort-amount-asc', 'sort-amount-asc'), ('sort-amount-desc', 'sort-amount-desc'), ('sort-asc', 'sort-asc'), ('sort-desc', 'sort-desc'), ('sort-down ', 'sort-down '), ('sort-numeric-asc', 'sort-numeric-asc'), ('sort-numeric-desc', 'sort-numeric-desc'), ('sort-up ', 'sort-up '), ('space-shuttle', 'space-shuttle'), ('spinner', 'spinner'), ('spoon', 'spoon'), ('square', 'square'), ('square-o', 'square-o'), ('star', 'star'), ('star-half', 'star-half'), ('star-half-empty ', 'star-half-empty '), ('star-half-full ', 'star-half-full '), ('star-half-o', 'star-half-o'), ('star-o', 'star-o'), ('sticky-note', 'sticky-note'), ('sticky-note-o', 'sticky-note-o'), ('street-view', 'street-view'), ('suitcase', 'suitcase'), ('sun-o', 'sun-o'), ('support ', 'support '), ('tablet', 'tablet'), ('tachometer', 'tachometer'), ('tag', 'tag'), ('tags', 'tags'), ('tasks', 'tasks'), ('taxi', 'taxi'), ('television', 'television'), ('terminal', 'terminal'), ('thermometer ', 'thermometer '), ('thermometer-0 ', 'thermometer-0 '), ('thermometer-1 ', 'thermometer-1 '), ('thermometer-2 ', 'thermometer-2 '), ('thermometer-3 ', 'thermometer-3 '), ('thermometer-4 ', 'thermometer-4 '), ('thermometer-empty', 'thermometer-empty'), ('thermometer-full', 'thermometer-full'), ('thermometer-half', 'thermometer-half'), ('thermometer-quarter', 'thermometer-quarter'), ('thermometer-three-quarters', 'thermometer-three-quarters'), ('thumb-tack', 'thumb-tack'), ('thumbs-down', 'thumbs-down'), ('thumbs-o-down', 'thumbs-o-down'), ('thumbs-o-up', 'thumbs-o-up'), ('thumbs-up', 'thumbs-up'), ('ticket', 'ticket'), ('times', 'times'), ('times-circle', 'times-circle'), ('times-circle-o', 'times-circle-o'), ('times-rectangle ', 'times-rectangle '), ('times-rectangle-o ', 'times-rectangle-o '), ('tint', 'tint'), ('toggle-down ', 'toggle-down '), ('toggle-left ', 'toggle-left '), ('toggle-off', 'toggle-off'), ('toggle-on', 'toggle-on'), ('toggle-right ', 'toggle-right '), ('toggle-up ', 'toggle-up '), ('trademark', 'trademark'), ('trash', 'trash'), ('trash-o', 'trash-o'), ('tree', 'tree'), ('trophy', 'trophy'), ('truck', 'truck'), ('tty', 'tty'), ('tv ', 'tv '), ('umbrella', 'umbrella'), ('universal-access', 'universal-access'), ('university', 'university'), ('unlock', 'unlock'), ('unlock-alt', 'unlock-alt'), ('unsorted ', 'unsorted '), ('upload', 'upload'), ('user', 'user'), ('user-circle', 'user-circle'), ('user-circle-o', 'user-circle-o'), ('user-o', 'user-o'), ('user-plus', 'user-plus'), ('user-secret', 'user-secret'), ('user-times', 'user-times'), ('users', 'users'), ('vcard ', 'vcard '), ('vcard-o ', 'vcard-o '), ('video-camera', 'video-camera'), ('volume-control-phone', 'volume-control-phone'), ('volume-down', 'volume-down'), ('volume-off', 'volume-off'), ('volume-up', 'volume-up'), ('warning ', 'warning '), ('wheelchair', 'wheelchair'), ('wheelchair-alt', 'wheelchair-alt'), ('wifi', 'wifi'), ('window-close', 'window-close'), ('window-close-o', 'window-close-o'), ('window-maximize', 'window-maximize'), ('window-minimize', 'window-minimize'), ('window-restore', 'window-restore'), ('wrench', 'wrench')], label='Icon', required=False)), ('text', wagtail.core.blocks.CharBlock(label='Text', max_length=120)), ('link', wagtail.core.blocks.URLBlock(default='Link', required=False))]), label='Link'))]))], blank=True, help_text='You should add only <b>1 Hero</b>', null=True)),
                ('body', wagtail.core.fields.StreamField([('map_catalog', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(label='Title', max_length=240)), ('featured_maps', wagtail.core.blocks.ListBlock(cartoview.cms.db_models.blocks.Blocks.FeaturedMapChooser(), label='Featured Maps'))])), ('grid', wagtail.core.blocks.StreamBlock([('column_1_1', wagtail.core.blocks.StructBlock([('column_0', wagtail.core.blocks.StreamBlock([('paragraph', wagtail.core.blocks.RichTextBlock()), ('image_text_overlay', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image')), ('text', wagtail.core.blocks.CharBlock(label='Text', max_length=200))])), ('thumbnail_gallery', wagtail.core.blocks.StructBlock([('style', wagtail.core.blocks.ChoiceBlock(choices=[('rounded', 'Square'), ('rounded-circle', 'Rounded')], label='Style')), ('image_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image'))]), label='Image'))]))])), ('column_1', wagtail.core.blocks.StreamBlock([('paragraph', wagtail.core.blocks.RichTextBlock()), ('image_text_overlay', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image')), ('text', wagtail.core.blocks.CharBlock(label='Text', max_length=200))])), ('thumbnail_gallery', wagtail.core.blocks.StructBlock([('style', wagtail.core.blocks.ChoiceBlock(choices=[('rounded', 'Square'), ('rounded-circle', 'Rounded')], label='Style')), ('image_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image'))]), label='Image'))]))]))], group='Columns', label='Two halves')), ('column_2_1', wagtail.core.blocks.StructBlock([('column_0', wagtail.core.blocks.StreamBlock([('paragraph', wagtail.core.blocks.RichTextBlock()), ('image_text_overlay', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image')), ('text', wagtail.core.blocks.CharBlock(label='Text', max_length=200))])), ('thumbnail_gallery', wagtail.core.blocks.StructBlock([('style', wagtail.core.blocks.ChoiceBlock(choices=[('rounded', 'Square'), ('rounded-circle', 'Rounded')], label='Style')), ('image_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image'))]), label='Image'))]))])), ('column_1', wagtail.core.blocks.StreamBlock([('paragraph', wagtail.core.blocks.RichTextBlock()), ('image_text_overlay', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image')), ('text', wagtail.core.blocks.CharBlock(label='Text', max_length=200))])), ('thumbnail_gallery', wagtail.core.blocks.StructBlock([('style', wagtail.core.blocks.ChoiceBlock(choices=[('rounded', 'Square'), ('rounded-circle', 'Rounded')], label='Style')), ('image_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image'))]), label='Image'))]))]))], group='Columns', label='Two thirds/One third')), ('column_1_1_1', wagtail.core.blocks.StructBlock([('column_0', wagtail.core.blocks.StreamBlock([('paragraph', wagtail.core.blocks.RichTextBlock()), ('image_text_overlay', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image')), ('text', wagtail.core.blocks.CharBlock(label='Text', max_length=200))])), ('thumbnail_gallery', wagtail.core.blocks.StructBlock([('style', wagtail.core.blocks.ChoiceBlock(choices=[('rounded', 'Square'), ('rounded-circle', 'Rounded')], label='Style')), ('image_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image'))]), label='Image'))]))])), ('column_1', wagtail.core.blocks.StreamBlock([('paragraph', wagtail.core.blocks.RichTextBlock()), ('image_text_overlay', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image')), ('text', wagtail.core.blocks.CharBlock(label='Text', max_length=200))])), ('thumbnail_gallery', wagtail.core.blocks.StructBlock([('style', wagtail.core.blocks.ChoiceBlock(choices=[('rounded', 'Square'), ('rounded-circle', 'Rounded')], label='Style')), ('image_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image'))]), label='Image'))]))])), ('column_2', wagtail.core.blocks.StreamBlock([('paragraph', wagtail.core.blocks.RichTextBlock()), ('image_text_overlay', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image')), ('text', wagtail.core.blocks.CharBlock(label='Text', max_length=200))])), ('thumbnail_gallery', wagtail.core.blocks.StructBlock([('style', wagtail.core.blocks.ChoiceBlock(choices=[('rounded', 'Square'), ('rounded-circle', 'Rounded')], label='Style')), ('image_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image'))]), label='Image'))]))]))], group='Columns', label='Three thirds'))])), ('paragraph', wagtail.core.blocks.RichTextBlock()), ('image_text_overlay', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image')), ('text', wagtail.core.blocks.CharBlock(label='Text', max_length=200))])), ('thumbnail_gallery', wagtail.core.blocks.StructBlock([('style', wagtail.core.blocks.ChoiceBlock(choices=[('rounded', 'Square'), ('rounded-circle', 'Rounded')], label='Style')), ('image_items', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(label='Image'))]), label='Image'))]))], blank=True, null=True)),
                ('selected_template', models.CharField(choices=[('cms/home_page_default.html', 'Default Template')], default='cms/home_page_default.html', max_length=255)),
            ],
            options={
                'verbose_name': 'Site Homepage',
            },
            bases=('wagtailcore.page',),
        ),
        migrations.CreateModel(
            name='MenuItem',
            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')),
                ('repeat_in_subnav', models.BooleanField(default=False, help_text="If checked, a link to this page will be repeated alongside it's direct children when displaying a sub-navigation for this page.", verbose_name='repeat in sub-navigation')),
                ('repeated_item_text', models.CharField(blank=True, help_text="e.g. 'Section home' or 'Overview'. If left blank, the page title will be used.", max_length=255, verbose_name='repeated item link text')),
            ],
            options={
                'abstract': False,
github wagtail / bakerydemo / bakerydemo / locations / migrations / 0003_auto_20170329_0055.py View on Github external
import wagtail.core.fields
import wagtail.embeds.blocks
import wagtail.images.blocks


class Migration(migrations.Migration):

    dependencies = [
        ('locations', '0002_remove_locationsindexpage_body'),
    ]

    operations = [
        migrations.AlterField(
            model_name='locationpage',
            name='body',
            field=wagtail.core.fields.StreamField((('heading_block', wagtail.core.blocks.StructBlock((('heading_text', wagtail.core.blocks.CharBlock(classname='title', required=True)), ('size', wagtail.core.blocks.ChoiceBlock(blank=True, choices=[('', 'Select a header size'), ('h2', 'H2'), ('h3', 'H3'), ('h4', 'H4')], required=False))))), ('paragraph_block', wagtail.core.blocks.RichTextBlock(icon='fa-paragraph', template='blocks/paragraph_block.html')), ('image_block', wagtail.core.blocks.StructBlock((('image', wagtail.images.blocks.ImageChooserBlock(required=True)), ('caption', wagtail.core.blocks.CharBlock(required=False)), ('attribution', wagtail.core.blocks.CharBlock(required=False))))), ('block_quote', wagtail.core.blocks.StructBlock((('text', wagtail.core.blocks.TextBlock()), ('attribute_name', wagtail.core.blocks.CharBlock(blank=True, label='e.g. Mary Berry', required=False))))), ('embed_block', wagtail.embeds.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='Page body'),
        ),
github mvantellingen / wagtail-factories / src / wagtail_factories / blocks.py View on Github external
class BlockFactory(factory.Factory):
    class Meta:
        abstract = True

    @classmethod
    def _build(cls, model_class, value):
        return model_class().clean(value)

    @classmethod
    def _create(cls, model_class, value):
        return model_class().clean(value)


class CharBlockFactory(BlockFactory):
    class Meta:
        model = blocks.CharBlock


class IntegerBlockFactory(BlockFactory):
    class Meta:
        model = blocks.IntegerBlock


class ChooserBlockFactory(BlockFactory):
    pass


class ImageChooserBlockFactory(ChooserBlockFactory):

    image = factory.SubFactory(ImageFactory)

    class Meta: