Open-Source
-Bibliothek für Django , die mit minimalem Aufwand eine powerful data table interface
(paginierte Informationen) bereitstellt – aktiv unterstützt von App-Generator .
Für einen vollständigen Satz an Funktionen und langfristigen Support schauen Sie sich Dynamic Django an, einen leistungsstarken Starter, der Folgendes beinhaltet:
Merkmale
Django
& VanillaJS
DT
Schicht, bereitgestellt von Simple-DataTablesServer-side
PaginierungMIT License
(kommerzielle Nutzung erlaubt) Schritt #1 –
Install the package
$ pip install django-dynamic-datatb
// OR
$ pip install git+https://github.com/app-generator/django-dynamic-datatb.git
Schritt #2 – Konfiguration aktualisieren,
add new imports
import os , inspect
import django_dyn_dt
Schritt #3 – Konfiguration aktualisieren,
include the new APPs
INSTALLED_APPS = [
'django_dyn_dt' , # <-- NEW App
]
Schritt #4 – Konfiguration aktualisieren, das neue
TEMPLATES
einschließen
TEMPLATE_DIR_DATATB = os . path . join ( BASE_DIR , "django_dyn_dt/templates" ) # <-- NEW App
TEMPLATES = [
{
"BACKEND" : "django.template.backends.django.DjangoTemplates" ,
"DIRS" : [ TEMPLATE_DIR_DATATB ], # <-- NEW Include
"APP_DIRS" : True ,
"OPTIONS" : {
},
},
]
Schritt 5 – Konfiguration aktualisieren,
STATICFILES_DIRS
DIR aktualisieren
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" ),
)
Schritt #6 –
Register the model
insettings.py
(Abschnitt DYNAMIC_DATATB)
In diesem Beispielcode wird davon ausgegangen, dass app1
vorhanden ist und das Book
definiert und migriert ist.
DYNAMIC_DATATB = {
# SLUG -> Import_PATH
'books' : "app1.models.Book" ,
}
Schritt #7 –
Update routing
, APIs einbinden
from django . contrib import admin
from django . urls import path , include # <-- NEW: 'include` directive added
urlpatterns = [
path ( "admin/" , admin . site . urls ),
path ( '' , include ( 'django_dyn_dt.urls' )), # <-- NEW: API routing rules
]
Schritt #8 – Verwenden Sie das Dynamic Datatable-Modul
Wenn das verwaltete Modell Books
ist, ist die dynamische Schnittstelle /datatb/books/
und alle Funktionen sind verfügbar.
AppSeed
Email
und Discord
Django Dynamic DataTables – Open-Source-Bibliothek, bereitgestellt von App-Generator