jSpreadsheet table blocks for Wagtail
Project description
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 + [
StreamFieldPanel('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 apply to the cell
v means the value of the style should be apply to the cell
Dependencies
- This project relies on Jspreadsheet Community Edition for data entry and manipulation.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wagtailtables-0.2.2.tar.gz.
File metadata
- Download URL: wagtailtables-0.2.2.tar.gz
- Upload date:
- Size: 174.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45bfcfda12e56e479fae05e0438efb5026928793d588c9d08101d5af27021544
|
|
| MD5 |
81f1707ce23c4c40e1a6c0ed15ffa09f
|
|
| BLAKE2b-256 |
1a529423d66f9c12fa4e9f9d7cf786ce21011b2d18d59622233c07dbbd736bc6
|
File details
Details for the file wagtailtables-0.2.2-py3-none-any.whl.
File metadata
- Download URL: wagtailtables-0.2.2-py3-none-any.whl
- Upload date:
- Size: 179.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52da006affb2e8b8f1357de9f04808110db12fd2f563b2c7c611cc68bbb54492
|
|
| MD5 |
583345f1c27f18c5b4d92f8bbfeb3e47
|
|
| BLAKE2b-256 |
7c01571b46439417048b0f2bfde7692beaf99e379acae09b90aba11926e3061a
|