Skip to main content

A fork of the wagtailnews plugin for Wagtail that provides news / blogging functionality. This fork exists to allow news items to belong to a collection, enforcing collection permissions and restrictions (including viewer restrictions, mirroring the Page queryset’s public() method and restricting unauthorized serving in the same way). This is done to facilitate wagtailnews working with the wagtailapproval plugin.

Installing

Install using pip:

pip install wagtailnews-collection

It works with Wagtail 1.4 and upwards.

Documentation

Documentation for Wagtail news can be found on Read The Docs. This fork has no specific documentation, as it works almost exactly the same.

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')

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 Distribution

If you're not sure about the file name format, learn more about wheel file names.

wagtailnews_collection-0.17.8-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file wagtailnews_collection-0.17.8-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtailnews_collection-0.17.8-py3-none-any.whl
Algorithm Hash digest
SHA256 79a61e8cd31576f6b4c6dbc65b50520ff6b5be82bfcd0bb438e447974e5e189a
MD5 fcb77ae3e5e5b2a52e3f319b553c4ce2
BLAKE2b-256 2731b0f5065f4df8389df13b4824b50f4c6fd54db9134fa5b62f0ae5229c45ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page