Forms, widgets, and blocks¶
Wagtail news integrates with Wagtail edit handlers and stream field blocks.
NewsChooserPanel
¶
-
class
wagtailnews.edit_handlers.
NewsChooserPanel
(field_name)[source]¶ An edit handler for editors to pick a news item. Takes the field name as the only argument. For example:
class FooPage(Page): news_item = models.ForeignKey('news.NewsItem') content_panels = Page.content_panels + [ NewsChooserPanel('news_item') }
NewsChooserBlock
¶
-
class
wagtailnews.blocks.
NewsChooserBlock
(target_model, **kwargs)[source]¶ A StreamField block for editors to pick a news item. Takes the news item class as its only argument. For example:
class FooPage(Page): content = StreamField([ ('text', RichTextField()), ('news', NewsChooserBlock('news.NewsItem')), ])