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 1.4 and upwards.
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.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')
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for wagtailnews-0.12.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 843c6e8512b53ce3952aeea687b1bbb1212625fdd29f2bcb9f374777a04d3e2f |
|
MD5 | 2b34052ccd5ff32f9abcd8d0fd7e9327 |
|
BLAKE2b-256 | d733484d0d12620b5f598e3265ed1ec33d1494eb3b8cc4a14be9d580380c4a59 |
Close
Hashes for wagtailnews-0.12.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8afa789161817b9224a0a8e783cb9447fb3131b10916be8990d4674a2b7eca02 |
|
MD5 | 1ded43b2eacdc17f70c1cad6c57439ee |
|
BLAKE2b-256 | 85a0ca9275f844c27fb0687317576cd91165dc677a7539cca90456288ac93c81 |