Django Tablefield
It uses Handsontable JS library (0.38.1 version. MIT Lisence). It is almost like wagtail's TableBlock.
But for plain Django and added functional of merge cells and alignment.
Installation
pip install django-tablefield
# or latest version
pip install git+https://github.com/raagin/django-tablefield.git
Using
# settings.py
INSTALLED_APPS = [
...
'tablefield',
...
]
# models.py
from tablefield.fields import TableField
class MyModel(models.Model):
table = TableField(verbose_name='Table')
In templates
{% load tablefield_tags %}
{% tablefield_render mymodel.table %}
Options
Default options is:
DEFAULT_TABLE_OPTIONS = {
'minSpareRows': 0,
'startRows': 3,
'startCols': 3,
'colHeaders': False,
'rowHeaders': False,
'mergeCells': True,
'contextMenu': [
'row_above',
'row_below',
'---------',
'col_left',
'col_right',
'---------',
'remove_row',
'remove_col',
'---------',
'mergeCells',
'---------',
'alignment',
'---------',
'undo',
'redo'
],
'editor': 'text',
'stretchH': 'all',
'height': 200,
'renderer': 'html',
'autoColumnSize': False,
}
As you see, default renderer is html.
You read about it: https://handsontable.com/docs/1.18.1/Options.html#renderer
You may set your options:
class MyModel(models.Model):
table = TableField(
table_options = {
'minSpareRows': 0,
'startRows': 3,
'startCols': 3,
'colHeaders': False,
'rowHeaders': False,
'mergeCells': True,
'contextMenu': [
'row_above',
'row_below',
'---------',
'col_left',
'col_right',
'---------',
'remove_row',
'remove_col',
'---------',
'mergeCells',
'---------',
'alignment',
'---------',
'undo',
'redo'
],
'editor': 'text',
'stretchH': 'all',
'height': 200,
'renderer': 'html',
'autoColumnSize': False,
},
verbose_name='Table'
)
Metadata
Release files for django-tablefield 0.0.5
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 | |
|---|---|---|---|---|
| django-tablefield-0.0.5.tar.gz | 166.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_tablefield-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 381.4 kB
Release files / django-tablefield-0.0.5.tar.gz
| Download URL | django-tablefield-0.0.5.tar.gz |
|---|---|
| Size | 166.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
986920d9979c8bf993a4171e104a3025510317aa22ecea74627f55de06953d89
|
|
BLAKE2b-256 checksum How to use checksums |
d43eaa297b775d6908ce9731130cdd1d14c77f68236a5bcd0ed288864155ffac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / django_tablefield-0.0.5-py3-none-any.whl
| Download URL | django_tablefield-0.0.5-py3-none-any.whl |
|---|---|
| Size | 215.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89c18cecad14694b6ae4ca464e6811a5e4c5f89fa8a206a1489cf0628318802e
|
|
BLAKE2b-256 checksum How to use checksums |
661a8c5ec7b8348964c3260089ecf6b60e59f5e1978c409fb43ccdce71381c55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for django-tablefield 0.0.5
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.