django dynamic datatb
v1.0.26
Django的Open-Source
庫,以最少的努力提供powerful data table interface
(分頁資訊) - 由App-Generator積極支援。
要獲得完整的功能集和長期支持,請查看Dynamic Django ,這是一個功能強大的入門工具,它包含:
特徵
Django
和VanillaJS
DT
層Server-side
分頁MIT License
(允許商業使用) 步驟#1 -
Install the package
$ pip install django-dynamic-datatb
// OR
$ pip install git+https://github.com/app-generator/django-dynamic-datatb.git
步驟#2 - 更新配置,
add new imports
import os , inspect
import django_dyn_dt
步驟#3 - 更新配置,
include the new APPs
INSTALLED_APPS = [
'django_dyn_dt' , # <-- NEW App
]
步驟 #4 - 更新配置,包括新的
TEMPLATES
DIR
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" : {
},
},
]
步驟#5 - 更新配置,更新
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" ),
)
步驟#6 - 在
settings.py
中Register the model
(DYNAMIC_DATATB 部分)
此範例程式碼假設app1
存在且模型Book
已定義並移轉。
DYNAMIC_DATATB = {
# SLUG -> Import_PATH
'books' : "app1.models.Book" ,
}
步驟#7 -
Update routing
,包括 API
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
]
步驟#8 - 使用動態資料表模組
如果託管模型是Books
,則動態介面是/datatb/books/
並且所有功能都可用。
AppSeed
提供的更多開發者工具Email
和Discord
尋求支持Django Dynamic DataTables - App-Generator提供的開源程式庫