Django Dynamic Datatables
Project description
Django Dynamic DataTables
Open-Source
library for Django that provides a powerful data table interface
(paginated information) with minimum effort - actively supported by AppSeed.
- Django Dynamic Services -
sample project that uses the library
- Django - Build Services without Coding -
video presentation
Features
- Modern Stack:
Django
&VanillaJS
DT
layer provided by Simple-DataTablesServer-side
pagination- Search, Filters
- Exports in PDF, CSV formats
MIT License
(commercial use allowed)
How to use it
Step #1 -
Install the package
$ pip install django-dynamic-datatb
// OR
$ pip install git+https://github.com/app-generator/django-dynamic-datatb.git
Step #2 - Update Configuration,
add new imports
import os, inspect
import django_dyn_dt
Step #3 - Update Configuration,
include the new APPs
INSTALLED_APPS = [
'django_dyn_dt', # <-- NEW App
]
Step #4 - Update Configuration, include the new
TEMPLATES
DIR
DATATB_TEMPLATES = os.path.join(BASE_DIR, "django_dyn_dt/templates") # <-- NEW Templates Include
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [DATATB_TEMPLATES], # <-- NEW Include
"APP_DIRS": True,
"OPTIONS": {
},
},
]
Step #5 - Update Configuration, update
STATICFILES_DIRS
DIR
DYN_DB_PKG_ROOT = os.path.dirname( inspect.getfile( django_dyn_dt ) ) # <-- NEW App
STATICFILES_DIRS = (
os.path.join(DYN_DB_PKG_ROOT, "templates/static"),
)
Step #6 -
Update routing
, include APIs
from django.contrib import admin
from django.urls import path, include # <-- NEW: 'include` directive added
from django.views.decorators.csrf import csrf_exempt # <-- NEW: csrf_exempt required
urlpatterns = [
path("admin/", admin.site.urls),
path('datatb/<str:model_name>/<int:pk>/', csrf_exempt(DataTB.as_view())), # <-- NEW: (Used by Dynamic DataTables)
path('datatb/<str:model_name>/' , csrf_exempt(DataTB.as_view())), # <-- NEW: (Used by Dynamic DataTables)
path('datatb/<str:model_name>/export/' , csrf_exempt(export)), # <-- NEW: (Used by Dynamic DataTables)
]
Step #7 - Use the Dynamic Datatable widget in controller
from django_dyn_dt.datatb import DataTB
def dyn_datatb(request):
context = {}
ddt = DataTB(model_class_path="home.models.Product") # Link Dynamic view to a Model (full path)
context['data_table1'] = ddt.render() # Render() returns the dynamic widget
return render(request, 'pages/dyn-datatb.html', context=context)
Links & resources
- DRF - HOMEpage
- More Developer Tools provided by
AppSeed
- Ask for Support via
Email
&Discord
Django Dynamic DataTables - Open-source library provided by AppSeed
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-dynamic-datatb-1.0.23.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7fad7e79a56d48d0012b019d131aa13ebee2a208b54ad10901d2b67887e5ca9 |
|
MD5 | ae395269fca26ca10b1402e9a11b1766 |
|
BLAKE2b-256 | fec5a786ec9fb3bd94df5162ed81b41a6fe6152c6ec4f866d7c5768b6165a077 |