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 4.0 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:
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 are severely out of date, but may still be useful for reference.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wagtailnews-4.0.0.tar.gz
(26.1 kB
view details)
Built Distribution
File details
Details for the file wagtailnews-4.0.0.tar.gz
.
File metadata
- Download URL: wagtailnews-4.0.0.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a48808566bdb4a9bc217222cd7a05608af3ab476d5ba18c9c3a8a7c668c0c59 |
|
MD5 | 2f2bba7421b23df438cedcd92895cf80 |
|
BLAKE2b-256 | b7564bef7d00cde656f535bd77a55d21d513fa19b921b023e6099c5fca5633e9 |
File details
Details for the file wagtailnews-4.0.0-py3-none-any.whl
.
File metadata
- Download URL: wagtailnews-4.0.0-py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 933ff9d62bdebb063a91a481423e1e2a665a6a0fc02cda05ba7312048124ed30 |
|
MD5 | a73b68394888c43667a0b9b460b014b1 |
|
BLAKE2b-256 | 28bcec1b5035535f2455204ca0761b3f76760543e608780412d49d392f55a6b2 |