Open-Source
library for Django that provides a powerful data table interface
(paginated information) with minimum effort - actively supported by App-Generator.
- Django Dynamic DataTables - video presentation
For a complete set of features and long-term support, check out Dynamic Django, a powerful starter that incorporates:
- Dynamic DataTables: using a single line of configuration, the data saved in any table is automatically managed
- Dynamic API: any model can become a secure API Endpoint using DRF
- Dynamic Charts: extract relevant charts without coding all major types are supported
- CSV Loader: translate CSV files into Django Models and (optional) load the information
- Powerful CLI Tools for the GIT interface, configuration editing, updating the configuration and database (create models, migrate DB)
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)
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
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": {
},
},
]
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 - Register the model
in settings.py
(DYNAMIC_DATATB section)
This sample code assumes that app1
exists and model Book
is defined and migrated.
DYNAMIC_DATATB = {
# SLUG -> Import_PATH
'books' : "app1.models.Book",
}
Step #7 - Update routing
, include APIs
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
]
Step #8 - Use the Dynamic Datatable module
If the managed model is Books
, the dynamic interface is /datatb/books/
and all features available.
- DRF - HOMEpage
- More Developer Tools provided by
AppSeed
- Ask for Support via
Email
&Discord
Django Dynamic DataTables - Open-source library provided by App-Generator
django-dynamic-datatb's People
Forkers
dtparker19 mortrest aymanfekri dreamsdesign ihesami songhyonkim mchoopani ts-soda ck1-ck teplovas avrcursos-dev dendidepp noubsc edwin-niwaha ghostsarah0042 iserhanext armvndj unmeshpt egoah-japan bakirbukvic hopckiendjango-dynamic-datatb's Issues
Custom DataTable
I think it is better to have a custom data table and not use bootstrap or simple-datatables
So, I implemented an initial table if you like it, inform me to complete it.
PDF, CSV export - not working
To be checked with Django Datta Able:
improvments for widgets
Choices option is not working, you can check below:
TRAINING_TYPE_CHOICES = (
(TRAINING, 'TRAINING'),
(MATCH, 'MATCH'),
(REGENERATION, 'REGENERATION'),
(REHABILITATION, 'REHABILITATION'),
(OTHER, 'OTHER'),
)
training_type = models.PositiveSmallIntegerField(choices=TRAINING_TYPE_CHOICES, default=1, null=False, blank=False)
DataField and TimeField Widget Problem. Widgets are wrong (date widget in time input)
training_date = models.DateField(null=True, blank=True, default='2020-05-21')
start_time = models.TimeField(null=True, blank=True, default='00:00:')
end_time = models.TimeField(null=True, blank=True, default='00:00:')
Usability - Solution to use the library as a widget
Hello @Mortrest
The current version of the library works as a separate page with its own links and actions.
We need to find a solution to provide the same features as a widget where the user can embed this dataTable element in any page.
The NEW requirements:
- Handle any model enabled by
Config
(as it is now) - Datatables View can be embedded in any page
- All Exports available
Here are some other packages that look more or less similar:
- https://pypi.org/search/?q=django+datatables (PyPi Search)
- https://pypi.org/project/django-serverside-datatable/
- https://pypi.org/project/django-datatables-serverside/
- https://pypi.org/project/djangorestframework-datatables/
Let's brain storm around these new requirements and let's go.
ty!
Improvements
Suggested in yTube
I would like to share feedback for further improvement:
- Allow for "default" fields that need to be shown in the list view. In my situation, not all fields are required to be shown in the list view, only when the detailed view is clicked they should be shown;
- Make default filters set - Similarly to the above one, default filters will be very useful, accomplishing the same thing as not showing not needed data;
- Unnecessary JS - There are a couple of places where JS is used to load data as well as certain fields. This makes it a bit more complex to read/understand than feeding the data in the actual Python template. e.g. The heading for the model name on the top of the page is configured with JS, but it's provided in the context of the view anyways, so a simple {{model_name}} will accomplish the same thing.
Adding columns of type picture to table
Using the model to build the database, I specified one of the fields:
photo=models.ImageField(upload_to="images/", blank=True, null=True)
but when adding a record, it is impossible to add a file or an image
is there any solution to this problem or should I deal with the code myself and rewrite some points?
"Related Field has invalid lookup: icontains"
Hello
Thank for the app, i couldn't make it work with my model, it seems like the app doesn't work with ForeignKey field or M2M fields
The issue appears in the view.py
for field in headings: filter_options = filter_options | Q(**{field + '__icontains': search_key})
i've tried to override the logic but couldn't make it run with my FK models
Thank you!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.