Skip to content

synw/django-tabular

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Django Tabular

Display tabular data in Django. This module was designed to integrate tabular data in django-chartflo dashboards.

Install

pip install goerr

Clone the repository and add "tabular" to installed apps

Usage

This will save an Table instance in the database and generate a chunk of html to be displayed. In a Chartflo generator (or in any function):

from django.contrib.auth.model import User
from tabular.models import Table
from tabular.factory import table

def run(events=None):
   slug = "all_users"
   q = User.objects.all()
   instance, _ = Table.objects.get_or_create(slug=slug)
   instance.name = "All users"
   instance.generator = "auth"
   instance.modelnames = "User"
   fields = ["date_created", "username", "first_name", "last_name", "email"]
   instance.html = table.generate(slug, q, fields)
   # save the instance in db
   instance.save()
   # generate the html
   instance.generate()

This will generate a templates/tabular/tables/all_users.html file

In a template:

{% include "tabular/tables/all_users.html" %}
{% include "tabular/script.html" %}

Credits

Tablefilter.js

About

Display tabular data in Django

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published