/django-auto-datatables

Auto-generated, database-driven datatables for Django

Primary LanguagePythonMIT LicenseMIT

Django Auto Datatables

Github Build Github Docs CodeCov GitHub GitHub last commit PyPI

Django Auto Datatables is a high-level API for creating datatables(.net) in Django. It provides a simple API for creating interactive datatables with minimal effort. The package supports all the features of datatables.net and allows for easy customization of the datatable. It also supports server-side processing and the scroller plugin for large API driven datatables.

Documentation

The full documentation is at https://ssjenny90.github.io/django-auto-datatables/

Table of Contents

Installation

Install Django Auto Datatables::

pip install django-auto-datatables

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...

    'auto_datatables',
    ...
)

Optional Dependencies

Django Auto Datatables also has an option dependencies on DRF ORJSON Renderer. If you are serializing large amounts of data and want the speed the comes with ORJSON, you can install it with the following command.

pip install django-auto-datatables[orjson]

Usage

Usage examples and guides on how to use your package in a Django project.

Configuration

Configuration options and settings available in your package.

Views

AutoTableMixin:

Templates

This package provides a single template which is called if the render_table template tag is used without arguments. The template is located at auto_datatables/table.html and can be overridden by creating a template with the same name in your project.

Template Tags

Django Auto Datatables provides the following template tags:

  • render_table: This tag can be used to render a datatable in a template. The tag accepts the current context and expects a number of variables to be present. Make sure to subclass any view with the BaseViewMixin to ensure the correct variables are present in the context.

Settings

AUTO_DATATABLES_DEFAULT_RENDERER = 'auto_datatables.renderers.DatatablesRenderer'

  • The default renderer to use when rendering the datatable. Defaults to 'auto_datatables.renderers.DatatablesRenderer'.

Contributing

Contributor guidelines can be found in the How to Contribute file.

License

This project is provided under the MIT License.

Changelog

Change Log is a log of changes made to the package. It is based on Keep a Changelog.

Support and Contact

A section to provide information about where users can get support for your package and how they can contact you for inquiries or issues.

Features

  • Simple API for creating interactive datatables
  • Allows for easy customization of the datatable
  • Supports all the features of datatables.net
  • Supports server-side processing

Experimental Features

  • Templated row output

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Development commands

pip install -r requirements_dev.txt
invoke -l

Acknowledgments

Django Auto Datatables relies heavily on previous work by the following projects: