Django Filtered Model Formset Tables
Re-usable Class-Based Views that integrate django-filter and django-tables2 with model formsets. Render and process a user-filterable, user-sortable modelformset in a table with just a few lines of code. Rainbows and unicorns!
Features
- Use a ModelForm / formset to define editable fields, add / delete, extra forms, etc.
- Use a FilterSet to define filters the formset's queryset
- Use a Table to lay out the formset, define paging, sorting, etc.
- Render the Table with its filtered formset in just a few lines of template code
Views
-
FilteredTableView
- Mixes FilterView with SingleTableMixin for views that Filter tabular data.
-
FilteredModelFormsetView
- Integrates FilterView with ModelFormsetView for views that Filter the queryset used by a formset
-
ModelFormsetTableView
- Integrates ModelFormsetView with SingleTableMixin for views that render a formset in a Table.
-
FilteredModelFormsetTableView
- Integrates FilterView, ModelFormsetView, and SingleTableMixin for views that Filter the queryset used by a formset and render the formset in a Table.
Note:
Table.Column options linkify and empty_values are overridden for columns
rendered as form fields
linkifyis incompatible with a form field representation, so is disabled;- to ensure 'empty' form fields are rendered,
empty_valuesis set to () (i.e., render all values)
Quick Start
-
Install the
django-fmftpackage from PyPI$ pip install django-fmft
For other installation methods see Installation.
-
Add
'fmft'toINSTALLED_APPS:INSTALLED_APPS = [ ..., "fmft", "django_tables2", "django_filters", "extra_views", # optional ..., ]
Get Me Some of That
Check Out the Demo App
pip install -e git+https://github.com/powderflask/django-fmft.git#egg=django-fmftpython manage.py migrate demopython manage.py loaddata demo/fmft_fixture.jsonpython manage.py runserver
Acknowledgments
Special thanks to BC Hydro, Chartwell, and all Contributors
Technology Colophon
This package just glues together the amazing functionality provided by django-filter, django-tables2, and django-extra-views.
Python3, Django, HTML5, CSS3, JavaScript
For Developers
$ pip install -r reqirements_dev.txt
Tests
$ pytest
or
$ tox
Code Style / Linting
$ isort
$ black
$ flake8
Versioning
- Semantic Versioning
$ bumpver show
Docs
Build / Deploy Automation
- invoke
$ invoke -l
- GitHub Actions (see .github/workflows)
- GitHub Webhooks (see settings/hooks)
Known Issues
- hidden form fields are rendered in first form field column - can't have dynamically hidden fields, hidden on some rows while visible in others, without a little magic.
TODO
My wish list...
- write test for case where form field is not included in table E.g. as when DELETE field not included in export table
Metadata
Release files for django-fmft 0.3.3
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 |
|---|---|---|---|---|
| django_fmft-0.3.3.tar.gz | 18.5 kB | Without provenance | Details for django_fmft-0.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_fmft-0.3.3-py3-none-any.whl | Python 3 | none | any | Details for django_fmft-0.3.3-py3-none-any.whl |
Total release size: 36.0 kB
Release files / django_fmft-0.3.3.tar.gz
| Download URL | django_fmft-0.3.3.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ec8a09dde21b6db5e4368e8bb2317f7f3424fa8263d8f17d4a5cc4295a8b7df
|
|
BLAKE2b-256 checksum How to use checksums |
c1c843c73a19792c2b06554d9e29c39e79b5cd072cc6d7c1a25d34df4aa2a6b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / django_fmft-0.3.3-py3-none-any.whl
| Download URL | django_fmft-0.3.3-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3dc50a476223b83041a49a253a333b4ff8e9ff20871e8c33010589d4ace19a7
|
|
BLAKE2b-256 checksum How to use checksums |
4351c4df1ab9552744136c3245b38a235549bdda36026b23fff8212dca439eba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for django-fmft 0.3.3
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.