Skip to main content

djangotables

Djangotables is a simple library for generating html tables with Django Framework using model data like django forms.


Djangotables is a simple yet powerful library. A library based on forms generated by Django, if you are already familiar with django forms it will be very easy to use django tables, otherwise it will be easy anyway :wink:

I had the idea of developing when I was developing a Dashboard and always had to write the tables several times in html :sleeping:

Installation

Simple djangotables can be installed with pip::

pip install djangotables

Requirements

  • Python 3.6; 3.7
  • Django 2.0; 2.1; 2.2

These are the officially supported python and package versions. Other versions will probably work

Usage

It's very simple to use, you just have to import djangotables.tables on your tables.py file and create your subclass like below.

from djangotables import tables

class UserTable(tables.Table):
    first_name = tables.TextField(label="First Name")
    last_name  = tables.TextField(label="Last Name")

So, in your vews.py file, just import your table class and instantiate it by passing the queryset

from .tables import UserTable
from django.contrib.auth.models import User

from django.shortcuts import render

def index(request):

    table = UserTable( User.objects.all() )

    return render( request, "index.html", {
        "table": table
    })

To finish, on your index.html template file you just have to do this

<!DOCTYPE html>
<html lang="en">
    <head> ... </head>
    <body>
        <table>
            {{ table | safe }}
        </table>
    </body>
</html>

Okay, this is how simple you can use djangotables to improve your daily development, feel free to contribute and help me make this little library bigger


Okay

Release files for djangotables 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangotables 0.0.3
File Size Uploaded
djangotables-0.0.3.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djangotables 0.0.3
File Interpreter ABI Platform
djangotables-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / djangotables-0.0.3.tar.gz

Download URL djangotables-0.0.3.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d61c43a1a275d911fa4ec7fb5a013d76c66c704d19cce82d2b58bbd13c063898
BLAKE2b-256 checksum
How to use checksums
2295b6d7067cfa5470614d122e2cda2c06e4771e519481b10c848b25545064fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

Release files / djangotables-0.0.3-py3-none-any.whl

Download URL djangotables-0.0.3-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a000dd9cab680a65633b2c5b2fb25551f87b2a1387340d7cc52a3232ba0b328f
BLAKE2b-256 checksum
How to use checksums
9da5e235a7a8c7eb659ec4c17d339fa936c1ffa24417b0c7837a3193f7ddd769
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page