Wagtail AlternateStreamField
This project provides an alternate implementation of Wagtail's StreamField. This was created to resolve issues with performance for more complicated block structures.
Basic Installation and Usage
To install use pip:
pip install wagtail-altstreamfield
Add "altstreamfield" to your Django Project's INSTALLED_APPS list.
Create some custom blocks and a wagtail.core.models.Page subclass like the following:
#filename: [yourapp]/models.py
from django.db import models
from wagtail.core.models import Page
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from altstreamfield.edit_handlers import AltStreamFieldPanel
from altstreamfield.fields import AltStreamField
from altstreamfield.blocks import (
StreamBlock,
StructBlock,
BooleanField,
CharField,
ChoiceField,
DocumentChooserField,
ImageChooserField,
IntegerField,
RichTextField,
StreamBlockField,
TextField,
)
# Create some custom blocks
HEADING_TYPE_CHOICES = (
('h1', 'H1'),
('h2', 'H2'),
('h3', 'H3'),
('h4', 'H4'),
('h5', 'H5'),
('h6', 'H6'),
)
class Heading(StructBlock):
heading_type = ChoiceField(choices=HEADING_TYPE_CHOICES, required=True)
text = CharField()
class Meta:
icon = 'title'
class Paragraph(StructBlock):
text = RichTextField()
class Meta:
icon = 'pilcrow'
class DocumentLink(StructBlock):
title = CharField()
document = DocumentChooserField()
class Meta:
icon = 'doc-empty'
class SimpleStreamBlock(StreamBlock):
heading = Heading()
paragraph = Paragraph()
document = DocumentLink()
# Create your models here.
class HomePage(Page):
body = AltStreamField(SimpleStreamBlock)
content_panels = Page.content_panels + [
AltStreamFieldPanel('body', classname='full'),
]
If you are creating a large number of blocks it is a good idea to separate the blocks into a separate module or modules.
Metadata
Release files for wagtail-altstreamfield 0.0.13
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 |
|---|---|---|---|---|
| wagtail-altstreamfield-0.0.13.tar.gz | 608.3 kB | Without provenance | Details for wagtail-altstreamfield-0.0.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wagtail_altstreamfield-0.0.13-py3-none-any.whl | Python 3 | none | any | Details for wagtail_altstreamfield-0.0.13-py3-none-any.whl |
Total release size: 1.2 MB
Release files / wagtail-altstreamfield-0.0.13.tar.gz
| Download URL | wagtail-altstreamfield-0.0.13.tar.gz |
|---|---|
| Size | 608.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
416eec41f7c8f7decd2e8aa0a1076c8b0794c148513132c87237233d7d64bd6b
|
|
BLAKE2b-256 checksum How to use checksums |
cd018273684fa9f98439122535926a68c5e4bcefbf341a1653f688abdc841e71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.12
|
Release files / wagtail_altstreamfield-0.0.13-py3-none-any.whl
| Download URL | wagtail_altstreamfield-0.0.13-py3-none-any.whl |
|---|---|
| Size | 621.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6dcf09563f334a860b7effba366d5ad9ab2c814ab837f6ce69622fb7f4bfe2a8
|
|
BLAKE2b-256 checksum How to use checksums |
b8bd1765bcaa1d7b2d7c40637de13a6c5d7a2bba01cf76e1e46bb45a4ff1842a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.12
|
Security for wagtail-altstreamfield 0.0.13
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.