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 Distribution

wagtailnews-0.5.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

wagtailnews-0.5.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wagtailnews-0.5.0.tar.gz
Algorithm Hash digest
SHA256 26f66eb0b79e2a98815a5ef546adfab547eef768d2d430e536ac6c0fa346db7f
MD5 a21728b72ad48af0d6320b3039183c8d
BLAKE2b-256 fabe059f7076d7c314ef5efbb414b9a95c845087914ee38e3e4e36b36d66c889

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wagtailnews-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0795820fec2a14872ff2586806e7c1de0d47d397ac855b79d267ec387eb007f5
MD5 bc4826be771a95173a8c69aa1d1bfddd
BLAKE2b-256 d58fb1b53c0ac0be7086121270fc6b4caf3639e601f3e42b9a0741cf03a2f3b0

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