A template only and DRY solution for creating tables.
Project description
dj-tables
A template only and DRY solution for creating tables.
Specifying how data is displayed should be exclusively done by the template, and this library aims to do this by providing powerful template tags for constructing complex tables.
The full documentation is available on Read the Docs.
Installation
Install the package using pip
:
pip install dj-tables
Add dj_tables
to your INSTALLED_APPS
:
INSTALLED_APPS =(
# ...
'dj_tables',
# ...
)
Basic Example
We start with this basic model:
class MyModel(Model):
my_field = CharField()
some_other_field = IntegerField()
and this generic ListView
:
class MyListView(ListView):
model = MyModel
template_name = 'some_template.html'
And creating the table in your template is straightfoward, add a few tableheader tags with the attributes you want to be rendered.
{% load dj_tables %}
{% table object_list %}
{% tableheader key='my_field' %}
{% tableheader key='some_other_field' %}
{% endtable %}
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file dj-tables-1.0.0.tar.gz
.
File metadata
- Download URL: dj-tables-1.0.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11424d49217ab993cbb73de5e0f5a04a46fda661040cc25bc3d5da6bbcb2cd35 |
|
MD5 | 7f80b938ad4293a70c978fed815d57d0 |
|
BLAKE2b-256 | 23b7a006e5a340aa4ed784336f789d23065ba9a07ebe94b77967777c7b9844fd |
File details
Details for the file dj_tables-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: dj_tables-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.23.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 167c7879aa25e84325b4d4f0eaed6754deeaba95ca3ea99798824085ca832731 |
|
MD5 | 8bbe0af1fc71873b0682040cae6e7466 |
|
BLAKE2b-256 | b7e52a8ba1de47821e11b4c4e6a0ac6260c797aa19426b46e06244ef49df5854 |