Skip to main content

Django Serverside Datatable

Downloads

This is a simple package that let you use Server-side Datatable in your Django Project

Supports datatable features such as Pagination, Search, etc...

Install

pip install django-serverside-datatable

How to use

Create a django View that inherits from ServerSideDatatableView. Example (backend):

# views.py

from django_serverside_datatable.views import ServerSideDatatableView


class ItemListView(ServerSideDatatableView):
	queryset = models.Item.objects.all()
	columns = ['name', 'code', 'description']


# urls.py
# add the following line to urlpatterns

path('data/', views.ItemListView.as_view()), 

Example (frontend):

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
	</head>
	<body>
		<h1>Items</h1>
		<hr>
		<table id="items-table">
			<thead>
				<tr>
					<th>Name</th>
					<th>Code</th>
					<th>Description</th>
				</tr>
			</thead>
			<tbody></tbody>
		</table>

		<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
		<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
		<script language="javascript">
			$(document).ready(function () {
				$('#items-table').dataTable({
					serverSide: true,
					sAjaxSource: "http://127.0.0.1:8000/data/",  // new url
                                        columns: [
                                            {name: "name", data: 0},
                                            {name: "code", data: 1},
                                            {name: "description", data: 2},
                                        ],
				});
			});
		</script>
	</body>
</html>

For further customization of Datatable, you may refer the Datatable official documentation.

Metadata

Release files for django-serverside-datatable 2.1.0

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

Source distribution (sdist)

Source distribution for django-serverside-datatable 2.1.0
File Size Uploaded
django_serverside_datatable-2.1.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-serverside-datatable 2.1.0
File Interpreter ABI Platform
django_serverside_datatable-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / django_serverside_datatable-2.1.0.tar.gz

Download URL django_serverside_datatable-2.1.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
931fdf735ae591e739486d1baf404cc1c9cda1b95a17b68cc0990053c75f54ce
BLAKE2b-256 checksum
How to use checksums
2553b29faa8352b6135a499ef5a87db80893a4cc55f9e01abaf4e2eb24cac7b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / django_serverside_datatable-2.1.0-py3-none-any.whl

Download URL django_serverside_datatable-2.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
594cdf961291759fcec7a1111e582f095207098327fc62486b7f4d7c130fe5ae
BLAKE2b-256 checksum
How to use checksums
0487154868772ef9872b600c857d9a4bd5e06d21b1aa62754c30ca082b73f736
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

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