Metadata-Version: 2.4
Name: wagtailnews
Version: 5.2.0
Summary: News / blog plugin for the Wagtail CMS
Home-page: https://github.com/neon-jungle/wagtailnews/
Author: Neon Jungle
Author-email: developers@neonjungle.studio
License: BSD License
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Wagtail
Classifier: Framework :: Wagtail :: 4
Classifier: Framework :: Wagtail :: 5
Classifier: License :: OSI Approved :: BSD License
License-File: LICENSE
Requires-Dist: wagtail>=5.2.0
Provides-Extra: docs
Requires-Dist: Sphinx>=1.4.6; extra == "docs"
Requires-Dist: sphinx-autobuild>=0.5.2; extra == "docs"
Requires-Dist: sphinx_rtd_theme>=0.1.8; extra == "docs"
Requires-Dist: sphinxcontrib-spelling==2.1.1; extra == "docs"
Requires-Dist: pyenchant==1.6.6; extra == "docs"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: summary

===========
wagtailnews
===========

A plugin for Wagtail that provides news / blogging functionality.

Installing
==========

Install using pip::

    pip install wagtailnews

It works with Wagtail 5.2 and upwards. For older versions of Wagtail see past releases.


Quick start
===========

Create news models for your application that inherit from the relevant ``wagtailnews`` models:

.. code:: python

    from django.db import models

    from wagtail.admin.panels import FieldPanel
    from wagtail.fields import RichTextField
    from wagtail.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'

        featured_news_item = models.ForeignKey(
            'NewsItem',
            null=True,
            blank=True,
            on_delete=models.SET_NULL,
            related_name='+',
        )

        content_panels = Page.content_panels + [
            FieldPanel('featured_news_item'), # This will set up a chooser for selecting a news item
        ]


    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)


Old docs
========

`The docs for Wagtail news <http://wagtail-news.readthedocs.org>`_ are severely out of date, but may still be useful for reference.
