Wagtail Content Stream
An abstract Django model with a Wagtail StreamField named body with multiple blocks I use on a regular basis. This is geared towards developers who need to write examples with code in them. It's opinionated: very little HTML is allowed in the text block, forcing authors to create structured data. The following blocks are included in ContentStreamBlock:
- Heading
- Paragraph
- Captioned Image
- Embed
- Table
- Code Block
A secondary StreamBlock, ContentStreamBlockWithRawCode, also provides an additional block for injecting HTML, JS, and CSS code. Use with care, as this can really blow up your markup and is a potential code injection point!
Three pages types are provided out-of-the-box.
Example Usage
You will need to add wagtailcodeblock to your INSTALLED_APPS Django setting.
Basic Usage: a Title Field and Content Stream
First, create a page type in your models.py:
from wagtailcontentstream.models import ContentStreamPage, SectionContentStreamPage, ContentStreamPageWithRawCode
class StandardPage(ContentStreamPage):
pass
class SectionStandardPage(SectionContentStreamPage):
pass
class StandardPageWithRawCode(ContentStreamPageWithRawCode):
pass
Then in your template:
{% load wagtailcore_tags %}
<h2>{{ page.title }}</h2>
{% include_block page.body %}
Extended Usage: Adding More Fields
from django.conf import settings
from django.db import models
from wagtail.admin.edit_handlers import FieldPanel
from wagtailcontentstream.models import ContentStreamPage
class StandardPage(ContentStreamPage):
date = models.DateField("Post Date")
authors = models.ManyToManyField(settings.AUTH_USER_MODEL)
content_panels = [
FieldPanel('date'),
FieldPanel('authors'),
] + ContentStreamPage.content_panels
Release Notes & Contributors
- Thank you to our wonderful contributors!
- Release notes are available on GitHub.
Project Maintainer
- Timothy Allen (https://github.com/FlipperPA)
Metadata
Release files for wagtailcontentstream 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wagtailcontentstream-1.0.0.tar.gz | 7.4 kB | Without provenance | Details for wagtailcontentstream-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wagtailcontentstream-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for wagtailcontentstream-1.0.0-py3-none-any.whl |
Total release size: 15.2 kB
Release files / wagtailcontentstream-1.0.0.tar.gz
| Download URL | wagtailcontentstream-1.0.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
460ef53b00dd7273c821dc848cecf00af71473f86d36ec3a87bc1e2351fc5fa1
|
|
BLAKE2b-256 checksum How to use checksums |
21a9caaf3a4c0f15586533e14f1bf851dd907865a2d24c5e4b3e63b9df2f9aa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
|
Release files / wagtailcontentstream-1.0.0-py3-none-any.whl
| Download URL | wagtailcontentstream-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
681449e95f86bde99cd1786d289174a746311b2f4176b8b03e72bb65b9d83b1b
|
|
BLAKE2b-256 checksum How to use checksums |
77f9104b4fd90ffd76ddc063c7c77876a95033ce8334d8dfa64f321e2db5edc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3
|
Security for wagtailcontentstream 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.