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.15.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

wagtailnews-0.15.0-py2-none-any.whl (30.4 kB view details)

Uploaded Python 2

File details

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

File metadata

File hashes

Hashes for wagtailnews-0.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9779e36c7e662f3fd5ed06cb4e019429b3e42009c8350f3df4b402dde5539745
MD5 1200c2a9301c1f0abef46e26a7c551ea
BLAKE2b-256 58b11348e9bb79f343b8a5855d31eeb1af44550c0bfcafef031195b100c852a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wagtailnews-0.15.0-py2-none-any.whl
Algorithm Hash digest
SHA256 6bdf9ee907c81c08962221f4a38fdc1900c355abfbb957471ca77cba7c4b9eed
MD5 c61a411e22bbe4ad02f8d716fdc6c4ba
BLAKE2b-256 b41f298b2187dc76cfd786e0996b1e8bc56b9704396180630e06d64ecb12bc0d

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