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 2.3 and upwards. For older versions of Wagtail see past releases.

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.admin.edit_handlers import FieldPanel
from wagtail.core.fields import RichTextField
from wagtail.core.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', on_delete=models.CASCADE)

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

Uploaded Source

Built Distribution

wagtailnews-2.7.2-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wagtailnews-2.7.2.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for wagtailnews-2.7.2.tar.gz
Algorithm Hash digest
SHA256 7174599b70f2f7be1d96c89d93f428e5306495517bdde47c4ed4aa6181de80e8
MD5 690c24172ea58b0a07d378b976552bcd
BLAKE2b-256 432813866ece2b8b18e70a0f4a1ed42c47f5ebca8ca943e846de7bdd8f4ecdb7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wagtailnews-2.7.2-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for wagtailnews-2.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 af72ca5e5e66f3d2fa3d77539f68ce7845ccf2990b90e97771a4c79feb3de96e
MD5 84943e5980e679b5c9fb1ecb761b85e4
BLAKE2b-256 f6d449b236170a36411c4c0e4a83aef652a1da02adc5564288ab91a7fa7d197e

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