Wagtail Tables
jspreadsheet tables in Wagtail, edited and customised from the Wagtail admin
Getting started
Assuming you have a Wagtail project up and running:
pip install wagtailtables
Add wagtailtables to your settings.py in the INSTALLED_APPS section, before the core wagtail packages:
INSTALLED_APPS = [
# ...
'wagtailtables',
# ...
]
Add a wagtailtables TableBlock to one of your StreamFields:
from wagtailtables.blocks import TableBlock
class ContentBlocks(StreamBlock):
table_block = TableBlock()
Include your streamblock in one of your pages
class HomePage(Page):
body = StreamField(ContentBlocks())
content_panels = Page.content_panels + [
FieldPanel('body'),
]
Simply render your table block as you would render any other block.
{% load wagtailcore_tags %}
{% block content %}
<div class="container-fluid">
<div class="row">
<div class="col-6">
<h1>{{self.title}}</h1>
<div class="excerpt">{{self.excerpt|richtext}}</div>
</div>
</div>
{% for block in self.body %}
{% include_block block %}
{% endfor %}
</div>
{% endblock %}
Configuration
Customized toolbar
TableBlock accepts a toolbar argument in addition to the standard StructBlock arguments.
The toolbar is an array of dicts, this is the default:
TOOLBAR = [
{'type': 'i', 'content': 'format_align_left', 'k': 'text-align', 'v': 'left'},
{'type': 'i', 'content': 'format_align_center', 'k':'text-align', 'v':'center'},
{'type': 'i', 'content': 'format_align_right', 'k': 'text-align', 'v': 'right'},
{'type': 'i', 'content': 'format_bold', 'k': 'font-weight', 'v': '600'},
{'type': 'i', 'content': 'format_italic', 'k': 'font-style', 'v': 'italic'},
{'type': 'i', 'content': 'border_left', 'k': 'border-left', 'v': '1px solid'},
{'type': 'i', 'content': 'border_right', 'k': 'border-right', 'v': '1px solid'},
{'type': 'i', 'content': 'border_top', 'k': 'border-top', 'v': '1px solid'},
]
class ContentBlocks(StreamBlock):
table_block = TableBlock(toolbar=TOOLBAR)
type should for now always be i for icon, we will provide more types later
content defines the icon (from material icons) click here for all possible keys
k means the style that should be applied to the cell
v means the value of the style should be applied to the cell
Dependencies
- This project relies on Jspreadsheet Community Edition for data entry and manipulation.
Release notes
Version 0.3.0
- Added support for Wagtail 8
- Removed support for Wagtail <7
- Use Wagtail's built-in
tableicon for the block
Version 0.2.2
- Added support for Wagtail 5
- Removed support for Wagtail <3
Version 0.2.1
- Added support for a customizable toolbar
Metadata
Release files for wagtailtables 0.3.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 |
|---|---|---|---|---|
| wagtailtables-0.3.0.tar.gz | 174.6 kB | Without provenance | Details for wagtailtables-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wagtailtables-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for wagtailtables-0.3.0-py3-none-any.whl |
Total release size: 354.0 kB
Release files / wagtailtables-0.3.0.tar.gz
| Download URL | wagtailtables-0.3.0.tar.gz |
|---|---|
| Size | 174.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc05a63a659597706cfd4eb82c9a18fa6678addb50c500ab28ea3534f19d4c43
|
|
BLAKE2b-256 checksum How to use checksums |
ce8a4245e13b1b94d13f3c7ebe3b3028dc2142679cbead8a11650bc36e970c14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / wagtailtables-0.3.0-py3-none-any.whl
| Download URL | wagtailtables-0.3.0-py3-none-any.whl |
|---|---|
| Size | 179.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b71368f62651b3577556924fb728c03e37514516768994c245c1f0d5e96e7cf
|
|
BLAKE2b-256 checksum How to use checksums |
59bf18b821e192535848fe56f5f8ca7673b252c222d341a93d45e9ede15f853c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for wagtailtables 0.3.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.