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.8.1.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

wagtailnews-0.8.1-py2.py3-none-any.whl (27.5 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for wagtailnews-0.8.1.tar.gz
Algorithm Hash digest
SHA256 cbfe0ddf6fd7b6ad39244b65dbbf3bb08114818c6ca4e392bf76dd8bdf2575d2
MD5 acc1d22d3d7f34370835f6cb61196da3
BLAKE2b-256 6f0b27dbc04daebb3de4d80c605afac4f22faa813a33c4dd4e59842ef99f32a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wagtailnews-0.8.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a595bf1230cff3cc7ef554cecc5fb4ea114458e999cecb2ad5984bbd09da8e0b
MD5 7db0ae7f939f77664fd715d445eb2c02
BLAKE2b-256 fdae43b380a88bd6bcf4ace0fe0cf4d5b9a0f5d1c13e1adab9c75485feaf5763

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