How to use the wagtail.core.fields.RichTextField 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 springload / wagtailmodelchoosers / tests / testapp / core / migrations / 0001_initial.py View on Github external
('wagtailcore', '0040_page_draft_title'),
    ]

    operations = [
        migrations.CreateModel(
            name='SimpleModel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=70)),
            ],
        ),
        migrations.CreateModel(
            name='SimplePage',
            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')),
                ('rich_text', wagtail.core.fields.RichTextField(blank=True)),
                ('optional_simple_model', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='core.SimpleModel')),
                ('required_simple_model', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.SimpleModel')),
            ],
            options={
                'abstract': False,
            },
            bases=('wagtailcore.page',),
        ),
github mdn / developer-portal / developerportal / apps / articles / migrations / 0003_article_intro.py View on Github external
# Generated by Django 2.2.1 on 2019-05-16 09:06

from django.db import migrations
import wagtail.core.fields


class Migration(migrations.Migration):

    dependencies = [("articles", "0002_article_date")]

    operations = [
        migrations.AddField(
            model_name="article",
            name="intro",
            field=wagtail.core.fields.RichTextField(default=None, verbose_name="Intro"),
        )
github torchbox / wagtail-torchbox / tbx / blog / migrations / 0001_initial.py View on Github external
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
                ('link_external', models.URLField(blank=True, verbose_name='External link')),
                ('title', models.CharField(help_text='Link title', max_length=255)),
                ('link_document', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='wagtaildocs.Document')),
            ],
            options={
                'ordering': ['sort_order'],
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BlogPage',
            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')),
                ('intro', wagtail.core.fields.RichTextField(blank=True, verbose_name='Intro (used for blog index and Planet Drupal listings)')),
                ('body', wagtail.core.fields.RichTextField(blank=True, verbose_name='body (deprecated. Use streamfield instead)')),
                ('colour', models.CharField(blank=True, choices=[('orange', 'Orange'), ('blue', 'Blue'), ('white', 'White')], max_length=255, verbose_name='Listing card colour if left blank will display image')),
                ('streamfield', wagtail.core.fields.StreamField([('h2', wagtail.core.blocks.CharBlock(classname='title', icon='title')), ('h3', wagtail.core.blocks.CharBlock(classname='title', icon='title')), ('h4', wagtail.core.blocks.CharBlock(classname='title', icon='title')), ('intro', wagtail.core.blocks.RichTextBlock(icon='pilcrow')), ('paragraph', wagtail.core.blocks.RichTextBlock(icon='pilcrow')), ('aligned_image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('alignment', tbx.core.blocks.ImageFormatChoiceBlock()), ('caption', wagtail.core.blocks.CharBlock()), ('attribution', wagtail.core.blocks.CharBlock(required=False))], label='Aligned image')), ('wide_image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock())], label='Wide image')), ('bustout', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock()), ('text', wagtail.core.blocks.RichTextBlock())])), ('pullquote', wagtail.core.blocks.StructBlock([('quote', wagtail.core.blocks.CharBlock(classname='quote title')), ('attribution', wagtail.core.blocks.CharBlock())])), ('raw_html', wagtail.core.blocks.RawHTMLBlock(icon='code', label='Raw HTML')), ('embed', wagtail.embeds.blocks.EmbedBlock(icon='code')), ('markdown', wagtailmarkdown.blocks.MarkdownBlock(icon='code'))])),
                ('author_left', models.CharField(blank=True, help_text='author who has left Torchbox', max_length=255)),
                ('date', models.DateField(verbose_name='Post date')),
                ('marketing_only', models.BooleanField(default=False, help_text='Display this blog post only on marketing landing page')),
                ('canonical_url', models.URLField(blank=True, max_length=255)),
                ('feed_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='torchbox.TorchboxImage')),
            ],
            options={
                'abstract': False,
            },
            bases=('wagtailcore.page',),
        ),
        migrations.CreateModel(
            name='BlogPageAuthor',
github mitodl / micromasters / cms / migrations / 0014_html_in_faq_answers.py View on Github external
from django.db import migrations
import wagtail.core.fields


class Migration(migrations.Migration):

    dependencies = [
        ('cms', '0013_programpage_thumbnail_image'),
    ]

    operations = [
        migrations.AlterField(
            model_name='frequentlyaskedquestion',
            name='answer',
            field=wagtail.core.fields.RichTextField(),
        ),
github AccordBox / wagtail-bootstrap-blog / wagtail_tuto / blog / migrations / 0002_auto_20180614_0223.py View on Github external
('default_value', models.CharField(blank=True, help_text='Default value. Comma separated values supported for checkboxes.', max_length=255, verbose_name='default value')),
                ('help_text', models.CharField(blank=True, max_length=255, verbose_name='help text')),
            ],
            options={
                'abstract': False,
                'ordering': ['sort_order'],
            },
        ),
        migrations.CreateModel(
            name='FormPage',
            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')),
                ('to_address', models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, verbose_name='to address')),
                ('from_address', models.CharField(blank=True, max_length=255, verbose_name='from address')),
                ('subject', models.CharField(blank=True, max_length=255, verbose_name='subject')),
                ('thank_you_text', wagtail.core.fields.RichTextField(blank=True)),
            ],
            options={
                'abstract': False,
            },
            bases=('wagtailcore.page',),
        ),
        migrations.AddField(
            model_name='formfield',
            name='page',
            field=modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='custom_form_fields', to='blog.FormPage'),
        ),
github wagtail / wagtail-personalisation / sandbox / sandbox / apps / home / models.py View on Github external
from __future__ import absolute_import, unicode_literals

from wagtail.admin.edit_handlers import RichTextFieldPanel, StreamFieldPanel
from wagtail.core import blocks
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page

from wagtail_personalisation.models import PersonalisablePageMixin
from wagtail_personalisation.blocks import PersonalisedStructBlock


class HomePage(PersonalisablePageMixin, Page):
    intro = RichTextField()
    body = StreamField([
        ('personalisable_paragraph', PersonalisedStructBlock([
            ('paragraph', blocks.RichTextBlock()),
        ], icon='pilcrow'))
    ])

    content_panels = Page.content_panels + [
        RichTextFieldPanel('intro'),
        StreamFieldPanel('body'),
    ]
github chrisdev / wagtail-cookiecutter-foundation / {{cookiecutter.project_slug}} / pages / models.py View on Github external
ImageChooserPanel('logo'),
        FieldPanel('site_name'),
    ]


class HomePageContentItem(Orderable, LinkFields):
    page = ParentalKey('pages.HomePage', related_name='content_items')
    image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='+'
    )
    title = models.CharField(max_length=100)
    content = RichTextField(null=True, blank=True,)
    summary = RichTextField(blank=True)
    slug = models.SlugField()

    panels = [
        FieldPanel('title'),
        ImageChooserPanel('image'),
        FieldPanel('summary'),
        FieldPanel('content'),
        FieldPanel('slug'),
        MultiFieldPanel(LinkFields.panels, "Link"),
    ]


class HomePageCarouselItem(Orderable, CarouselItem):
    page = ParentalKey('pages.HomePage', related_name='carousel_items')
github uwhumansvszombies / uwhvz / app / models / wagtail / game_info.py View on Github external
context['game'] = game

        announcements = self.get_children().type(AnnouncementPage).live().order_by('-first_published_at')
        viewable_announcements = [a for a in announcements if a.specific.is_viewable_by(participant)]
        context['announcements'] = viewable_announcements

        missions = self.get_children().type(MissionPage).live().order_by('-first_published_at')
        viewable_missions = [m for m in missions if m.specific.is_viewable_by(participant)]
        context['missions'] = viewable_missions
        return context


class AnnouncementPage(Page):
    template = "wagtail/announcement.html"

    body: str = RichTextField(blank=True)
    viewable_by: Enum = models.CharField(choices=[(tag.value, tag.label) for tag in ViewableBy], max_length=1)
    game: Game = models.ForeignKey(Game, on_delete=models.PROTECT)

    content_panels = Page.content_panels + [
        FieldPanel('viewable_by'),
        FieldPanel('game'),
        FieldPanel('body', classname="full"),
    ]

    parent_page_types = ['app.GameInfoPage']
    subpage_types = []

    def get_admin_display_title(self) -> str:
        return f'<{self.get_viewable_by_display()}> {self.draft_title or self.title}'

    def get_context(self, request, *args, **kwargs):
github mozilla / foundation.mozilla.org / network-api / networkapi / wagtailpages / pagemodels / base.py View on Github external
class ParticipateHighlights2(ParticipateHighlightsBase):
    page = ParentalKey(
        'wagtailpages.ParticipatePage2',
        related_name='featured_highlights2',
    )


class Homepage(FoundationMetadataPageMixin, Page):
    hero_headline = models.CharField(
        max_length=140,
        help_text='Hero story headline',
        blank=True,
    )

    hero_story_description = RichTextField(
        features=[
            'bold', 'italic', 'link',
        ]
    )

    hero_image = models.ForeignKey(
        'wagtailimages.Image',
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
        related_name='hero_image'
    )

    hero_button_text = models.CharField(
        max_length=50,
        blank=True
github TakwimuAfrica / Takwimu / takwimu / migrations / 0047_port_python_3_20190315_1031.py View on Github external
field=models.URLField(blank=True, help_text='TAKWIMU Twitter account URL', null=True),
        ),
        migrations.AlterField(
            model_name='socialmediasetting',
            name='youtube',
            field=models.URLField(blank=True, help_text='TAKWIMU YouTube channel or account URL', null=True),
        ),
        migrations.AlterField(
            model_name='supportservicessetting',
            name='services',
            field=wagtail.core.fields.StreamField([('service', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=True)), ('icon', takwimu.models.dashboard.IconChoiceBlock(required=False)), ('cover', wagtail.images.blocks.ImageChooserBlock(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', required=False)), ('description', wagtail.core.blocks.RichTextBlock(required=True)), ('category', wagtail.core.blocks.ChoiceBlock(choices=[('Standard', 'Standard'), ('Premium', 'Premium'), ('Persona', 'Persona')], max_length=20))]))], blank=True),
        ),
        migrations.AlterField(
            model_name='supportsetting',
            name='address',
            field=wagtail.core.fields.RichTextField(blank=True, help_text='TAKWIMU address', null=True),
        ),
        migrations.AlterField(
            model_name='supportsetting',
            name='community',
            field=models.URLField(blank=True, help_text='TAKWIMU Community forums URL', null=True),
        ),
        migrations.AlterField(
            model_name='supportsetting',
            name='hello',
            field=models.EmailField(blank=True, help_text='TAKWIMU main email address', max_length=254, null=True),
        ),
        migrations.AlterField(
            model_name='supportsetting',
            name='support',
            field=models.EmailField(blank=True, help_text='TAKWIMU support email address', max_length=254, null=True),
        ),