Skip to main content

News / blog plugin for the Wagtail CMS

Project description

A plugin for Wagtail that provides news / blogging functionality.

Installing

Install using pip:

pip install wagtailnews

It works with Wagtail 1.4 and upwards.

Documentation

Documentation for Wagtail news can be found on Read The Docs

Quick start

Create news models for your application that inherit from the relevant wagtailnews models:

from django.db import models

from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailcore.models import Page

from wagtailnews.models import NewsIndexMixin, AbstractNewsItem, AbstractNewsItemRevision
from wagtailnews.decorators import newsindex


# The decorator registers this model as a news index
@newsindex
class NewsIndex(NewsIndexMixin, Page):
    # Add extra fields here, as in a normal Wagtail Page class, if required
    newsitem_model = 'NewsItem'


class NewsItem(AbstractNewsItem):
    # NewsItem is a normal Django model, *not* a Wagtail Page.
    # Add any fields required for your page.
    # It already has ``date`` field, and a link to its parent ``NewsIndex`` Page
    title = models.CharField(max_length=255)
    body = RichTextField()

    panels = [
        FieldPanel('title', classname='full title'),
        FieldPanel('body', classname='full'),
    ] + AbstractNewsItem.panels

    def __str__(self):
        return self.title


class NewsItemRevision(AbstractNewsItemRevision):
    newsitem = models.ForeignKey(NewsItem, related_name='revisions')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

wagtailnews-0.13.0-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

wagtailnews-0.13.0-py2-none-any.whl (30.6 kB view details)

Uploaded Python 2

File details

Details for the file wagtailnews-0.13.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtailnews-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6367f97b7bf63f405cc4ec6065a49d8012c1d31499198bc703df39e9e87fc0ca
MD5 5b0e3d4e156497d95b9de65f05d5a243
BLAKE2b-256 512e35c8ac2fa84cf8ebfea72711ffd68444ca003bfab04ecb9e6e7dfdf05799

See more details on using hashes here.

File details

Details for the file wagtailnews-0.13.0-py2-none-any.whl.

File metadata

File hashes

Hashes for wagtailnews-0.13.0-py2-none-any.whl
Algorithm Hash digest
SHA256 d001753b84e791b6b92225e25c6c32ecb2a01d8fd7c3a0a80bb702eab7cbe26c
MD5 eb1994a1eab1f05e7eae4540be05e7b0
BLAKE2b-256 7c1cb12fe460020f2a6ad172c45a67b02fca15eb2fbe3c10c551f01cc6362e47

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page