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 0.7 and upwards.

Using

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 __unicode__(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.6.1-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

wagtailnews-0.6.1-py2.py3-none-any.whl (24.0 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for wagtailnews-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8f72cd3ca89e71269e6f384038c0d226b227a3a392214745c7d3a1276d9fca08
MD5 da5cd89584b27a1604172fb5f529d1ab
BLAKE2b-256 af4fc2aa24efa9d8e4d684c9fb3e9cc466e44bc87bff8493701394548719c518

See more details on using hashes here.

File details

Details for the file wagtailnews-0.6.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for wagtailnews-0.6.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fd90e6b08f2c6ba688487f87101438219bf20834114a9f64e01a62a05adac70e
MD5 95a793255dcd7d3ae89715a7db7a92d4
BLAKE2b-256 efdb8426eb91b73d1cf40adb45961a885f429a36fb1324bb3bdd3e4d98567050

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