Django Datatable View

screenshot of Django Datatable View
django

Server-side datatable representations for Django querysets for automatic rendering in templates

Overview

The DataTable View package is designed to be used with the jQuery plugin DataTables. It provides support for state-saving detection with fnSetFilteringDelay. The package includes a class-based view and utilities for rendering table data from models. The package requires Python 3.8 or later and Django 2.2 or later, as well as the dateutil library and jQuery.

Features

  • DatatableView: A drop-in replacement for ListView that allows options to be specified for the datatable that will be rendered on the page.
  • MultipleDatatableView: Allows for configuring multiple Datatable specifications on a single view.
  • Form-like declarative table design: Provides a form-like declarative table design similar to how Django forms work.
  • Support for ValuesQuerySet execution mode: Supports executing the queryset as a ValuesQuerySet instead of returning object instances.
  • Queryset caching between requests: Caches the queryset between requests for improved performance.
  • Customizable table headers: Allows customization of table headers.
  • Compound columns: Supports columns that represent more than one model field.
  • Columns backed by methods or callbacks: Supports columns that are backed by methods or callbacks instead of model fields.
  • Easy related fields: Provides easy support for rendering related fields in the table.
  • Automatic search and sort support: Automatically enables searching and sorting of table data.
  • Total control over cell contents: Allows for HTML and processing of raw values in the table cells.
  • Search data fields not present on the table: Supports searching data fields that are not present on the table.
  • Support for DT_RowData: Provides support for adding custom data to rows.
  • Customization hook for full JSON response object: Allows customization of the full JSON response object.
  • Drop-in x-editable support: Supports x-editable for inline editing of table data on a per-column basis.
  • Customizable table templates: Allows customization of the table templates.
  • Easy Bootstrap integration: Provides easy integration with Bootstrap.
  • Supports all normal DataTables.js and x-editable options: Supports all normal options provided by DataTables.js and x-editable.
  • Small library of common column markup processors: Includes a small library of common column markup processors.
  • Full test suite: Comes with a full test suite for ensuring stable functionality.

Summary

The DataTable View package is a useful tool for integrating the jQuery plugin DataTables with Django. It provides a range of features for rendering table data from models, including support for searching, sorting, compound columns, related fields, and more. The package is easy to install and use, and comes with comprehensive documentation and a test suite for ensuring stable functionality. Overall, the DataTable View package is a valuable resource for developers working with Django and DataTables.

django
Django

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It follows the model-view-controller (MVC) architectural pattern, providing an extensive set of built-in tools and conventions to streamline the creation of robust and scalable web applications.