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 Distribution

wagtailnews-2.1.0.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

wagtailnews-2.1.0-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file wagtailnews-2.1.0.tar.gz.

File metadata

  • Download URL: wagtailnews-2.1.0.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for wagtailnews-2.1.0.tar.gz
Algorithm Hash digest
SHA256 20368a539d9707cab0ae7bd84d797f0f5dbed1b8cb18309b380659293e4322a4
MD5 0ffd9eb79e7f4ff3cd703ab678e07f07
BLAKE2b-256 6fdc9903f1918fa16970f4bac5f5765767bb7284805a8a5c5441b2263668fcf2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wagtailnews-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23f2fde6ce34c78d8589ba56e8bf9a5c9cd8850285d4704e9d19ba8ad883430e
MD5 3a04551325f2d542dbff39a6a766328d
BLAKE2b-256 02723313909584ffc044a343005d26b013b4fe8fe4338db763640fea3b55ad1f

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