Dynamic DataTables#
This page explains how the Dynamic DataTables feature of Dynamic Django that allows to manage large amounts of information using a server-side paginated view.
👉 New to App-Generator? Sign IN with GitHub or Generate Web Apps in no time (free service).
Configuration#
The django_dyn_dt, the application that handles the feature, is registered in the INSTALLED_APPS section.
INSTALLED_APPS = [
...
"django_dyn_api",
...
]
Dynamic DataTable section (also covered in the configuration page) provides a simple way to specify the models that are automatically managed.
The section is a dictionary where the key is the segment of the endpoint and the value the import path of the model. Here are the DEMOs for the default models:
Sales Dynamic Tables View: Demo Link
Product Dynamic Tables View: Demo Link
# Syntax: URI -> Import_PATH
DYNAMIC_DATATB = {
"product": "home.models.Product",
"sales": "home.models.Sales",
}
Add a new Model#
Besides the default tables view (Sales and Product models), the Dynamic DataTable feature can be extended to any new model. Here are the steps to enable a new endpoint
Define a new model Homework in the home aplication
class Homework(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=100)
content = models.TextField(blank=True, null=True, default='')
Migrate the database
python manage.py makemigrations
python manage.py migrate
Update the configuration: DYNAMIC_API section
# Syntax: URI -> Import_PATH
DYNAMIC_DATATB = {
"product": "home.models.Product",
"sales": "home.models.Sales",
"homework": "home.models.Homework", # <-- NEW
}
The new view is now listed in the Dynamic DataTable page and ready to be used.
The new DataTable for the newly created model
Deploy on Render#
This video material explains how to process CSV files and convert them into secure APIs and server-side data tables using Dynamic Django tool.
Links#
👉 New to App-Generator? Join our 10k+ Community using GitHub One-Click SignIN.
👉
Download
products and start fast a new project👉 Bootstrap your startUp, MVP or Legacy project with a custom development sprint